public final class ScsiResponseDataSegment extends Object
It may contain either SenseData
, IResponseData
, or (rarely) both. Some SCSI commands require that no
response data is sent (i.e. data segment length = 0) - in these cases the EMPTY_DATA_SEGMENT
shall be used.
Since the target must honor the buffer size the initiator has allocated for data returned in the data segment, the
serialize()
method will only write as many bytes to the passed ByteBuffer
as specified during
initialization.
TargetPduFactory
Modifier and Type | Field and Description |
---|---|
static ScsiResponseDataSegment |
EMPTY_DATA_SEGMENT
A
ScsiResponseDataSegment of length zero. |
Constructor and Description |
---|
ScsiResponseDataSegment(IResponseData responseData,
int allocationLength)
Creates a
ScsiResponseDataSegment with IResponseData . |
ScsiResponseDataSegment(SenseData senseData,
int allocationLength)
Creates a
ScsiResponseDataSegment with SenseData . |
Modifier and Type | Method and Description |
---|---|
int |
getResidualCount()
Returns the number of bytes that had to be cropped due to the total length of all contained fields exceeding the
allocationLength . |
boolean |
getResidualOverflow()
Indicates if any bytes have to be cropped during
serialize() calls. |
ByteBuffer |
serialize()
Returns a
ByteBuffer containing a serialized representation of this object. |
int |
uncroppedSize()
The length of the
ScsiResponseDataSegment , without considering any limitations due to
allocationLength . |
public static final ScsiResponseDataSegment EMPTY_DATA_SEGMENT
ScsiResponseDataSegment
of length zero.public ScsiResponseDataSegment(SenseData senseData, int allocationLength)
ScsiResponseDataSegment
with SenseData
.senseData
- the sense data sent as the result of SCSI errorallocationLength
- number of bytes the initiator has allocated for data sent in the data segmentpublic ScsiResponseDataSegment(IResponseData responseData, int allocationLength)
ScsiResponseDataSegment
with IResponseData
.responseData
- the data requested by the initiatorallocationLength
- number of bytes the initiator has allocated for data sent in the data segmentpublic ByteBuffer serialize()
ByteBuffer
containing a serialized representation of this object.ByteBuffer
containing a serialized representation of this objectpublic int uncroppedSize()
ScsiResponseDataSegment
, without considering any limitations due to
allocationLength
.
The returned value is calculated just once, and then stored in uncroppedSize
. This summation is
performed only if uncroppedSize
is negative.
ScsiResponseDataSegment
, without considering any limitations due to
allocationLength
public boolean getResidualOverflow()
serialize()
calls. The method returns true
if and only if the serialized length of this objects exceeds allocationLength
.true
if and only if the serialized length of this objects exceeds allocationLength
public int getResidualCount()
allocationLength
.serialize()
Copyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.