Coverage Report - org.jscsi.target.scsi.cdb.ReadCapacity16Cdb
 
Classes in this File Line Coverage Branch Coverage Complexity
ReadCapacity16Cdb
0%
0/7
0%
0/2
1.25
 
 1  
 package org.jscsi.target.scsi.cdb;
 2  
 
 3  
 
 4  
 import java.nio.ByteBuffer;
 5  
 
 6  
 import org.jscsi.target.util.BitManip;
 7  
 
 8  
 
 9  
 /**
 10  
  * This class represents Command Descriptor Blocks for the <code>READ CAPACITY (16)</code> SCSI command.
 11  
  * 
 12  
  * @author Andreas Ergenzinger
 13  
  */
 14  
 public class ReadCapacity16Cdb extends ReadCapacityCdb {
 15  
 
 16  
     /**
 17  
      * The mandatory value of the SERVICE ACTION field.
 18  
      */
 19  
     private static final byte SERVICE_ACTION = 0x10;
 20  
 
 21  
     /**
 22  
      * The value of the SERVICE ACTION field.
 23  
      * <p>
 24  
      * The value of this 5-bit field must equal {@link #SERVICE_ACTION}. Its meaning is described in SPC-4.
 25  
      */
 26  
     private final byte serviceAction;
 27  
 
 28  
     public ReadCapacity16Cdb (ByteBuffer buffer) {
 29  0
         super(buffer);
 30  
         // deserialize SERVICE ACTION field
 31  0
         serviceAction = (byte) (buffer.get(1) & 31);
 32  0
         if (serviceAction != SERVICE_ACTION) addIllegalFieldPointer(1, 4);
 33  0
     }
 34  
 
 35  
     @Override
 36  
     protected long deserializeLogicalBlockAddress (ByteBuffer buffer) {
 37  0
         return buffer.getLong(2);
 38  
     }
 39  
 
 40  
     @Override
 41  
     protected boolean deserializePartialMediumIndicator (ByteBuffer buffer) {
 42  0
         return BitManip.getBit(buffer.get(14),// byte
 43  
                 0);// bitNumber
 44  
     }
 45  
 
 46  
     public byte getServiceAction () {
 47  0
         return serviceAction;
 48  
     }
 49  
 }