| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ShortLogicalBlockDescriptor |
|
| 1.0;1 |
| 1 | package org.jscsi.target.scsi.modeSense; | |
| 2 | ||
| 3 | ||
| 4 | import java.nio.ByteBuffer; | |
| 5 | ||
| 6 | import org.jscsi.target.util.ReadWrite; | |
| 7 | ||
| 8 | ||
| 9 | /** | |
| 10 | * A class representing the content of SHORT LBA MODE PAREMETER LOGICAL BLOCK DESCRIPTOR fields, which are part of | |
| 11 | * {@link ModeParameterList} objects. This short format must be used if the LONG LBA bit is not set in the | |
| 12 | * {@link ModeParameterList} objects's header. | |
| 13 | * | |
| 14 | * @see LongLogicalBlockDescriptor | |
| 15 | * @author Andreas Ergenzinger | |
| 16 | */ | |
| 17 | public final class ShortLogicalBlockDescriptor extends LogicalBlockDescriptor { | |
| 18 | ||
| 19 | /** | |
| 20 | * The serialized length in bytes of instances of this class. | |
| 21 | */ | |
| 22 | static final int SIZE = 8; | |
| 23 | ||
| 24 | /** | |
| 25 | * The constructor. | |
| 26 | * | |
| 27 | * @param numberOfLogicalBlocks the number of equal-length logical blocks into which the storage medium is divided | |
| 28 | * @param logicalBlockLength the length in bytes of the logical blocks | |
| 29 | */ | |
| 30 | public ShortLogicalBlockDescriptor (long numberOfLogicalBlocks, int logicalBlockLength) { | |
| 31 | 0 | super(numberOfLogicalBlocks, logicalBlockLength); |
| 32 | 0 | } |
| 33 | ||
| 34 | public void serialize (ByteBuffer byteBuffer, int index) { | |
| 35 | // NUMBER OF LOGICAL BLOCKS | |
| 36 | 0 | ReadWrite.writeInt((int) numberOfLogicalBlocks,// value |
| 37 | byteBuffer,// buffer | |
| 38 | index);// start index | |
| 39 | ||
| 40 | // LOGICAL BLOCK LENGTH | |
| 41 | 0 | ReadWrite.writeThreeByteInt(byteBuffer,// buffer |
| 42 | logicalBlockLength,// value | |
| 43 | index + 5);// index | |
| 44 | 0 | } |
| 45 | ||
| 46 | public int size () { | |
| 47 | 0 | return SIZE; |
| 48 | } | |
| 49 | ||
| 50 | } |