| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ReadCapacity16ParameterData |
|
| 1.0;1 |
| 1 | package org.jscsi.target.scsi.readCapacity; | |
| 2 | ||
| 3 | ||
| 4 | import java.nio.ByteBuffer; | |
| 5 | ||
| 6 | import org.jscsi.target.util.ReadWrite; | |
| 7 | ||
| 8 | ||
| 9 | /** | |
| 10 | * <code>READ CAPACITY (16)</code> parameter data is sent in response to a successful <code> READ CAPACITY (16)</code> | |
| 11 | * SCSI command. | |
| 12 | * <p> | |
| 13 | * Only the fields common to all {@link ReadCapacityParameterData} can be set in the constructor. All other fields and | |
| 14 | * flags are <code>zero</code>. This means that the initiator is told that the device does not support protection | |
| 15 | * information (protection type 0), maps each logical block directly to one physical block, beginning with the first | |
| 16 | * one. | |
| 17 | * | |
| 18 | * @author Andreas Ergenzinger | |
| 19 | */ | |
| 20 | public final class ReadCapacity16ParameterData extends ReadCapacityParameterData { | |
| 21 | ||
| 22 | /** | |
| 23 | * The length in bytes of serialized READ CAPACITY (16) parameter data. | |
| 24 | */ | |
| 25 | private static final int SIZE = 32; | |
| 26 | ||
| 27 | public ReadCapacity16ParameterData (final long returnedLogicalBlockAddress, int logicalBlockLengthInBytes) { | |
| 28 | 0 | super(returnedLogicalBlockAddress, logicalBlockLengthInBytes); |
| 29 | 0 | } |
| 30 | ||
| 31 | public void serialize (ByteBuffer byteBuffer, int index) { | |
| 32 | // returned logical block address | |
| 33 | 0 | ReadWrite.writeLong(byteBuffer, returnedLogicalBlockAddress, index); |
| 34 | ||
| 35 | // logical block length in bytes | |
| 36 | 0 | ReadWrite.writeInt(logicalBlockLengthInBytes, byteBuffer, index + 8); |
| 37 | 0 | } |
| 38 | ||
| 39 | public int size () { | |
| 40 | 0 | return SIZE; |
| 41 | } | |
| 42 | ||
| 43 | } |