Top Description Fields Constructors Methods
org.apache.derby.impl.drda

pack-priv Class DDMReader

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, java.math.BigDecimal, org.apache.derby.shared.common.sanity.SanityManager

The DDMReader is used to read DRDA protocol. DRDA Protocol is divided into three layers corresponding to the DDM three-tier architecture. For each layer, their is a DSS (Data Stream Structure) defined. Layer A Communications management services Layer B Agent services Layer C Data management services

At layer A are request, reply and data correlation, structure chaining, continuation or termination of chains when errors are detected, interleaving and multi-leaving request, reply, and data DSSs for multitasking environments. For TCP/IP, the format of the DDM envelope is 2 bytes Length of the data 1 byte 'D0' - indicates DDM data 1 byte DDM format byte(DSSFMT) - type of DSS(RQSDSS,RPYDSS), whether it is chained, information about the next chained DSS 2 bytes request correlation identifier

The correlation identifier ties together a request, the request data and the reply. In a chained DSS, each request has a correlation identifier which is higher than the previous request (all correlation identifiers must be greater than 0).

At layer B are object mapping, object validation and command routing. Layer B objects with data 5 bytes less than 32K bytes consist of 2 bytes Length 2 bytes Type of the object (code point) Object data Object data is either SCALAR or COLLECTION data. Scalar data consists of a string of bytes formatted as the class description of the object required. Collections consist of a set of objects in which the entries in the collection are nested within the length/ code point of the collection.

Layer B objects with data >=32763 bytes long format is 2 bytes Length - length of class, length, and extended total length fields (high order bit set, indicating >=32763) 2 bytes Type of the object (code point) n bytes Extended total length - length of the object (n = Length - 4) Object data

At layer C are services each class of DDM object provides. |-------------------------------------------| Layer C | Specific | Specific | Specific | | Commands | Replies | Scalars and | | and their | and their | Collections | |-------------------------------------------|----------------| Layer B | Commands | Reply | Scalars and | Communications | | | Messages | Collections | | |-----------|---------------|---------------|----------------| Layer A | RQSDSS | RPYDSS | OBJDSS | CMNDSS | | | | | Mapped Data | |-----------|---------------|---------------|----------------| | DDM Data Stream Structures | |------------------------------------------------------------| DSS's may be chained so that more than one can be transmitted at a time to improve performance. For more details, see DRDA Volume 3 (Distributed Data Management(DDM) Architecture (DDS definition)

Field Summary

Modifier and TypeField and Description
private static final boolean
private DRDAConnThread
private byte[]
private CcsidManager
private int
private long[]
private long
private static final int
private boolean
private int
private boolean
private boolean
private boolean
private int
private DssTrace
private EbcdicCcsidManager
private static final int
private InputStream
private static final long
private static final int
private static final boolean
private static final int
private int
private int
private int
private static final int[][]
private boolean
private int
pack-priv volatile long
private Utf8CcsidManager

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
DDMReader(InputStream inputStream)

This constructor is used for testing the protocol It is used by ProtocolTestAdapter to read the protocol returned by the server

Method Summary

Modifier and TypeMethod and Description
private void
adjustLengths(int
- adjustment length
length
)

Adjust remaining length

protected void
private void
compressBLayerData(int
- amount of data we need
continueDssHeaderCount
)

Compress B Layer data if extended total length is used by removing the continuation headers

private int[]

Returns:

array of int magnitudes
computeMagnitude
(int[]
value segments
input
)

Compute the int array of magnitude from input value segments.

protected String

Returns:

string
convertBytes
(byte[]
- byte array
buf
)

Convert EBCDIC byte array to unicode string

pack-priv boolean
private void
ensureALayerDataInBuffer(int
- amount of data we need
desiredDataSize
)

Make sure a certain amount of Layer A data is in the buffer.

private void
ensureBLayerDataInBuffer(int
- amount of data we need
desiredDataSize
,
boolean
- whether to adjust the remaining lengths
adjustLen
)

Make sure a certain amount of Layer B data is in the buffer.

private void
ensureSpaceInBufferForFill(int
- amount of data we need
desiredSpace
)

This method makes sure there is enough room in the buffer for a certain number of bytes.

private void
fill(int
- minimum required bytes
minimumBytesNeeded
)

This method will attempt to read a minimum number of bytes from the underlying stream.

private void
protected int

Returns:

NO_CODEPOINT if collection stack is empty or remaining length is 0; otherwise, read length and code point
getCodePoint
()

Get the next CodePoint from a collection

protected int

Returns:

codePoint
getCodePoint
(int
- codePoint to check against
codePointCheck
)

Get the next CodePoint from a collection and check that it matches the specified CodePoint

protected byte
getCurrChainState()

Return chaining bit for current DSS.

protected long

Returns:

length of DDM object
getDdmLength
()

Length of current DDM object

pack-priv byte[]
getExtData(long desiredLength, boolean checkNullability)

pack-priv EXTDTAReaderInputStream

Returns:

EXTDTAReaderInputStream object which can be passed to prepared statement as a binary stream.
getEXTDTAReaderInputStream
(final boolean
used to check if the stream is null. If it is null, this method returns null
checkNullability
)

Creates an InputStream which can stream EXTDTA objects.

protected void
initialize(DRDAConnThread agent, DssTrace dssTrace)

Initialize values for this session, the reader is reused so we need to set null and 0 values

protected boolean

Returns:

true if next DSS has a different correlator than current DSS
isChainedWithDiffID
()

Next DSS has different correlator than current DSS

protected boolean

Returns:

true if next DSS has the same correlator as current DSS
isChainedWithSameID
()

Next DSS has same correlator as current DSS

protected boolean

Returns:

true if this is a command; false otherwise
isCmd
()

Check for the command protocol

private boolean
protected void
markCollection()

Push DDM Length on to collection stack

protected boolean

Returns:

true if there is more data in the buffer
moreData
()

Is there more data in the buffer

protected boolean

Returns:

true if DDM length is > 0
moreDdmData
()

Is there more in this DDM object

protected boolean

Returns:

true if DDS length is > 0
moreDssData
()

Is there more in this DDS object

private int

Returns:

an int value
packedNybblesToInt
(byte[]
buffer to read from
buffer
,
int
offset in the buffer
offset
,
int
start nybble
startNybble
,
int
number of nybbles
numberOfNybbles
)

Convert a range of packed nybbles (up to 9 digits without overflow) to an int.

private long

Returns:

an long value
packedNybblesToLong
(byte[]
buffer to read from
buffer
,
int
offset in the buffer
offset
,
int
start nybble
startNybble
,
int
number of nybbles
numberOfNybbles
)

Convert a range of packed nybbles (up to 18 digits without overflow) to a long.

protected BigDecimal

Returns:

value
readBigDecimal
(int
of the BigDecimal
precision
,
int
of the BigDecimal
scale
)

Read a BigDecimal value

protected byte

Returns:

value
readByte
()

Read byte value

protected byte[]

Returns:

byte array
readBytes
(int
- length of string to read
length
)

Read byte string value

protected byte[]

Returns:

byte array
readBytes
()

Read byte string value

protected String

Returns:

value
readCmdString
(int
- length of string to read
length
)

Read string value

protected String

Returns:

value
readCmdString
()

Read string value

protected int

Returns:

- returns codepoint
readCodePoint
()

Read the CodePoint

protected double

Returns:

value
readDouble
(int byteOrder)

Read platform double value

private void
protected int
readDssHeader()

Read DSS header DSS Header format is 2 bytes - length 1 byte - 'D0' - indicates DDM data 1 byte - DSS format |---|---------|----------| | 0 | flags | type | |---|---------|----------| | 0 | 1 2 3 | 4 5 6 7 | |---|---------|----------| bit 0 - '0' bit 1 - '0' - unchained, '1' - chained bit 2 - '0' - do not continue on error, '1' - continue on error bit 3 - '0' - next DSS has different correlator, '1' - next DSS has same correlator type - 1 - Request DSS - 2 - Reply DSS - 3 - Object DSS - 4 - Communications DSS - 5 - Request DSS where no reply is expected 2 bytes - request correlation id

protected String

Returns:

decrypted string
readEncryptedString
(DecryptionManager
decryption manager
decryptM
,
int
security mechanism
securityMechanism
,
byte[]
initialization vector for cipher
initVector
,
byte[]
public key (as in Deffie-Hellman algorithm) from source (encryptor)
sourcePublicKey
)

Read encrypted string

protected float

Returns:

value
readFloat
(int byteOrder)

Read platform float value

protected int

Returns:

value
readInt
(int byteOrder)

Read platform int value

protected String

Returns:

value
readLDStringData
(String encoding)

Read length delimited string value in DDM data with default encoding

protected int

Returns:

- returns codepoint
readLengthAndCodePoint
(boolean
true only when layer B streaming is possible
isLayerBStreamingPossible
)

Read the DDM Length and CodePoint

private ByteArrayInputStream
readLOBChunk(final boolean
set to true if the dss continuation should be read
readHeader
,
final long
the desired length of chunk. This parameter is ignored when layerB Streaming is doing.
desiredLength
)

This method is used by EXTDTAReaderInputStream to read the next chunk of data.

pack-priv ByteArrayInputStream
readLOBContinuationStream()

This method is used by EXTDTAReaderInputStream to read the next chunk of data.

pack-priv ByteArrayInputStream
readLOBContinuationStream(final long
the desired length of chunk. This parameter is ignored when layerB Streaming is doing.
desiredLength
)

This method is used by EXTDTAReaderInputStream to read the next chunk of data.

pack-priv ByteArrayInputStream
readLOBInitStream()

This method is used by EXTDTAReaderInputStream to read the first chunk of data.

pack-priv ByteArrayInputStream
readLOBInitStream(final long
the desired length of chunk. This parameter is ignored when layerB Streaming is doing.
desiredLength
)

This method is used by EXTDTAReaderInputStream to read the first chunk of data.

protected long

Returns:

value
readLong
(int byteOrder)

Read platform long value

protected int

Returns:

value
readNetworkInt
()

Read network int value

protected long

Returns:

value
readNetworkLong
()

Read network long value

protected int

Returns:

value
readNetworkShort
()

Read network short value

protected long

Returns:

value
readNetworkSixByteLong
()

Read network six byte value and put it in a long v

protected void
readReplyDss()

Read Reply DSS This is used in testing the protocol.

protected short

Returns:

value
readShort
(int byteOrder)

Read platform short value

protected int

Returns:

value
readSignedNetworkShort
()

Read signed network short value

protected String

Returns:

value
readString
(int
- length of string to read
length
)

Read string value Strings in DRDA protocol are encoded in EBCDIC by default so we need to convert to UCS2

protected void
readString(DRDAString
destination for the read string
dst
,
int
size (in bytes) of string to read
size
,
boolean
if true, remove padding (trailing spaces)
unpad
)

Read string value into a DRDAString object.

protected String

Returns:

value
readString
(int
- length of string to read
length
,
String encoding)

Read encoded string value

protected String
readString()

Read string value

protected String

Returns:

value
readStringData
(int
- length of string to read
length
)

Read specified length of string value in DDM data with default encoding

protected int

Returns:

value
readUnsignedByte
()

Read byte value and mask out high order bytes before returning

protected void
protected void
private void
shiftBuffer(byte[]
- buffer to shift data to
destinationBuffer
)

This is a helper method which shifts the buffered bytes from wherever they are in the current buffer to the beginning of different buffer (note these buffers could be the same).

protected void
skipBytes(int
- length of string to skip
length
)

Skip byte string value

protected void
skipBytes()

Skip byte string value

protected void
skipDss()

Skip remaining DSS

private void
protected boolean
private void
trace(String msg)

Print a internal trace message

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ADJUST_LENGTHSback to summary
private static final boolean ADJUST_LENGTHS
agentback to summary
private DRDAConnThread agent
bufferback to summary
private byte[] buffer
ccsidManagerback to summary
private CcsidManager ccsidManager
countback to summary
private int count
ddmCollectionLenStackback to summary
private long[] ddmCollectionLenStack
ddmScalarLenback to summary
private long ddmScalarLen
DEFAULT_BUFFER_SIZEback to summary
private static final int DEFAULT_BUFFER_SIZE
doingLayerBStreamingback to summary
private boolean doingLayerBStreaming
dssCorrelationIDback to summary
private int dssCorrelationID
dssIsChainedWithDiffIDback to summary
private boolean dssIsChainedWithDiffID
dssIsChainedWithSameIDback to summary
private boolean dssIsChainedWithSameID
dssIsContinuedback to summary
private boolean dssIsContinued
dssLengthback to summary
private int dssLength
dssTraceback to summary
private DssTrace dssTrace
ebcdicCcsidManagerback to summary
private EbcdicCcsidManager ebcdicCcsidManager
EMPTY_STACKback to summary
private static final int EMPTY_STACK
inputStreamback to summary
private InputStream inputStream
MAX_EXTDTA_SIZEback to summary
private static final long MAX_EXTDTA_SIZE
MAX_MARKS_NESTINGback to summary
private static final int MAX_MARKS_NESTING
NO_ADJUST_LENGTHSback to summary
private static final boolean NO_ADJUST_LENGTHS
NO_CODEPOINTback to summary
private static final int NO_CODEPOINT
posback to summary
private int pos
prevCorrelationIDback to summary
private int prevCorrelationID
svrcodback to summary
private int svrcod
tenRadixMagnitudeback to summary
private static final int[][] tenRadixMagnitude
terminateChainOnErrback to summary
private boolean terminateChainOnErr
topDdmCollectionStackback to summary
private int topDdmCollectionStack
totalByteCountback to summary
pack-priv volatile long totalByteCount
utf8CcsidManagerback to summary
private Utf8CcsidManager utf8CcsidManager

Constructor Detail

DDMReaderback to summary
pack-priv DDMReader(DRDAConnThread agent, DssTrace dssTrace)
DDMReaderback to summary
pack-priv DDMReader(InputStream inputStream)

This constructor is used for testing the protocol It is used by ProtocolTestAdapter to read the protocol returned by the server

Method Detail

adjustLengthsback to summary
private void adjustLengths(int length)

Adjust remaining length

Parameters
length:int

- adjustment length

clearBufferback to summary
protected void clearBuffer() throws DRDAProtocolException
compressBLayerDataback to summary
private void compressBLayerData(int continueDssHeaderCount) throws DRDAProtocolException

Compress B Layer data if extended total length is used by removing the continuation headers

Parameters
continueDssHeaderCount:int

- amount of data we need

computeMagnitudeback to summary
private int[] computeMagnitude(int[] input)

Compute the int array of magnitude from input value segments.

Parameters
input:int[]

value segments

Returns:int[]

array of int magnitudes

convertBytesback to summary
protected String convertBytes(byte[] buf)

Convert EBCDIC byte array to unicode string

Parameters
buf:byte[]

- byte array

Returns:String

string

doingLayerBStreamingback to summary
pack-priv boolean doingLayerBStreaming()
ensureALayerDataInBufferback to summary
private void ensureALayerDataInBuffer(int desiredDataSize) throws DRDAProtocolException

Make sure a certain amount of Layer A data is in the buffer. The data will be in the buffer after this method is called.

Parameters
desiredDataSize:int

- amount of data we need

ensureBLayerDataInBufferback to summary
private void ensureBLayerDataInBuffer(int desiredDataSize, boolean adjustLen) throws DRDAProtocolException

Make sure a certain amount of Layer B data is in the buffer. The data will be in the buffer after this method is called.

Parameters
desiredDataSize:int

- amount of data we need

adjustLen:boolean

- whether to adjust the remaining lengths

Exceptions
DRDAProtocolException:
if a protocol error is detected
ensureSpaceInBufferForFillback to summary
private void ensureSpaceInBufferForFill(int desiredSpace)

This method makes sure there is enough room in the buffer for a certain number of bytes. This method will allocate a new buffer if needed and shift the bytes in the current buffer to make ensure space is available for a fill. Right now this method will shift bytes as needed to make sure there is as much room as possible in the buffer before trying to do the read. The idea is to try to have space to get as much data as possible if we need to do a read on the socket's stream.

Parameters
desiredSpace:int

- amount of data we need

fillback to summary
private void fill(int minimumBytesNeeded) throws DRDAProtocolException

This method will attempt to read a minimum number of bytes from the underlying stream. This method will keep trying to read bytes until it has obtained at least the minimum number.

Parameters
minimumBytesNeeded:int

- minimum required bytes

Exceptions
DRDAProtocolException:
if a protocol error is detected
finishLayerBStreamingback to summary
private void finishLayerBStreaming()
getCodePointback to summary
protected int getCodePoint() throws DRDAProtocolException

Get the next CodePoint from a collection

Returns:int

NO_CODEPOINT if collection stack is empty or remaining length is 0; otherwise, read length and code point

Exceptions
DRDAProtocolException:
if a protocol error is detected
getCodePointback to summary
protected int getCodePoint(int codePointCheck) throws DRDAProtocolException

Get the next CodePoint from a collection and check that it matches the specified CodePoint

Parameters
codePointCheck:int

- codePoint to check against

Returns:int

codePoint

Exceptions
DRDAProtocolException:
if a protocol error is detected
getCurrChainStateback to summary
protected byte getCurrChainState()

Return chaining bit for current DSS.

getDdmLengthback to summary
protected long getDdmLength()

Length of current DDM object

Returns:long

length of DDM object

getExtDataback to summary
pack-priv byte[] getExtData(long desiredLength, boolean checkNullability) throws DRDAProtocolException
getEXTDTAReaderInputStreamback to summary
pack-priv EXTDTAReaderInputStream getEXTDTAReaderInputStream(final boolean checkNullability) throws DRDAProtocolException

Creates an InputStream which can stream EXTDTA objects. The InputStream uses this DDMReader to read data from network. The DDMReader should not be used before all data in the stream has been read.

Parameters
checkNullability:boolean

used to check if the stream is null. If it is null, this method returns null

Returns:EXTDTAReaderInputStream

EXTDTAReaderInputStream object which can be passed to prepared statement as a binary stream.

Exceptions
DRDAProtocolException:
standard DRDA protocol exception
initializeback to summary
protected void initialize(DRDAConnThread agent, DssTrace dssTrace)

Initialize values for this session, the reader is reused so we need to set null and 0 values

isChainedWithDiffIDback to summary
protected boolean isChainedWithDiffID()

Next DSS has different correlator than current DSS

Returns:boolean

true if next DSS has a different correlator than current DSS

isChainedWithSameIDback to summary
protected boolean isChainedWithSameID()

Next DSS has same correlator as current DSS

Returns:boolean

true if next DSS has the same correlator as current DSS

isCmdback to summary
protected boolean isCmd() throws DRDAProtocolException, UnsupportedEncodingException

Check for the command protocol

Returns:boolean

true if this is a command; false otherwise

Exceptions
DRDAProtocolException:
if a protocol error is detected
isEXTDTANullback to summary
private boolean isEXTDTANull() throws DRDAProtocolException
markCollectionback to summary
protected void markCollection()

Push DDM Length on to collection stack

moreDataback to summary
protected boolean moreData()

Is there more data in the buffer

Returns:boolean

true if there is more data in the buffer

moreDdmDataback to summary
protected boolean moreDdmData()

Is there more in this DDM object

Returns:boolean

true if DDM length is > 0

moreDssDataback to summary
protected boolean moreDssData()

Is there more in this DDS object

Returns:boolean

true if DDS length is > 0

packedNybblesToIntback to summary
private int packedNybblesToInt(byte[] buffer, int offset, int startNybble, int numberOfNybbles)

Convert a range of packed nybbles (up to 9 digits without overflow) to an int. Note that for performance purpose, it does not do array-out-of-bound checking.

Parameters
buffer:byte[]

buffer to read from

offset:int

offset in the buffer

startNybble:int

start nybble

numberOfNybbles:int

number of nybbles

Returns:int

an int value

packedNybblesToLongback to summary
private long packedNybblesToLong(byte[] buffer, int offset, int startNybble, int numberOfNybbles)

Convert a range of packed nybbles (up to 18 digits without overflow) to a long. Note that for performance purpose, it does not do array-out-of-bound checking.

Parameters
buffer:byte[]

buffer to read from

offset:int

offset in the buffer

startNybble:int

start nybble

numberOfNybbles:int

number of nybbles

Returns:long

an long value

readBigDecimalback to summary
protected BigDecimal readBigDecimal(int precision, int scale) throws DRDAProtocolException

Read a BigDecimal value

Parameters
precision:int

of the BigDecimal

scale:int

of the BigDecimal

Returns:BigDecimal

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readByteback to summary
protected byte readByte() throws DRDAProtocolException

Read byte value

Returns:byte

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readBytesback to summary
protected byte[] readBytes(int length) throws DRDAProtocolException

Read byte string value

Parameters
length:int

- length of string to read

Returns:byte[]

byte array

Exceptions
DRDAProtocolException:
if a protocol error is detected
readBytesback to summary
protected byte[] readBytes() throws DRDAProtocolException

Read byte string value

Returns:byte[]

byte array

Exceptions
DRDAProtocolException:
if a protocol error is detected
readCmdStringback to summary
protected String readCmdString(int length) throws DRDAProtocolException, UnsupportedEncodingException

Read string value

Parameters
length:int

- length of string to read

Returns:String

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readCmdStringback to summary
protected String readCmdString() throws DRDAProtocolException, UnsupportedEncodingException

Read string value

Returns:String

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readCodePointback to summary
protected int readCodePoint()

Read the CodePoint

Returns:int

- returns codepoint

readDoubleback to summary
protected double readDouble(int byteOrder) throws DRDAProtocolException

Read platform double value

Returns:double

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readDSSContinuationHeaderback to summary
private void readDSSContinuationHeader() throws DRDAProtocolException
readDssHeaderback to summary
protected int readDssHeader() throws DRDAProtocolException

Read DSS header DSS Header format is 2 bytes - length 1 byte - 'D0' - indicates DDM data 1 byte - DSS format |---|---------|----------| | 0 | flags | type | |---|---------|----------| | 0 | 1 2 3 | 4 5 6 7 | |---|---------|----------| bit 0 - '0' bit 1 - '0' - unchained, '1' - chained bit 2 - '0' - do not continue on error, '1' - continue on error bit 3 - '0' - next DSS has different correlator, '1' - next DSS has same correlator type - 1 - Request DSS - 2 - Reply DSS - 3 - Object DSS - 4 - Communications DSS - 5 - Request DSS where no reply is expected 2 bytes - request correlation id

Exceptions
DRDAProtocolException:
if a protocol error is detected
readEncryptedStringback to summary
protected String readEncryptedString(DecryptionManager decryptM, int securityMechanism, byte[] initVector, byte[] sourcePublicKey) throws DRDAProtocolException, SQLException

Read encrypted string

Parameters
decryptM:DecryptionManager

decryption manager

securityMechanism:int

security mechanism

initVector:byte[]

initialization vector for cipher

sourcePublicKey:byte[]

public key (as in Deffie-Hellman algorithm) from source (encryptor)

Returns:String

decrypted string

Exceptions
DRDAProtocolException:
if a protocol error is detected
SQLException:
wrapping any exception in decryption
readFloatback to summary
protected float readFloat(int byteOrder) throws DRDAProtocolException

Read platform float value

Returns:float

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readIntback to summary
protected int readInt(int byteOrder) throws DRDAProtocolException

Read platform int value

Returns:int

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readLDStringDataback to summary
protected String readLDStringData(String encoding) throws DRDAProtocolException

Read length delimited string value in DDM data with default encoding

Returns:String

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readLengthAndCodePointback to summary
protected int readLengthAndCodePoint(boolean isLayerBStreamingPossible) throws DRDAProtocolException

Read the DDM Length and CodePoint

Parameters
isLayerBStreamingPossible:boolean

true only when layer B streaming is possible

Returns:int

- returns codepoint

Exceptions
DRDAProtocolException:
if a protocol error is detected
readLOBChunkback to summary
private ByteArrayInputStream readLOBChunk(final boolean readHeader, final long desiredLength) throws DRDAProtocolException

This method is used by EXTDTAReaderInputStream to read the next chunk of data. Furthermore, when Layer B streaming is carried out, calling this method may finish layer B streaming.

Parameters
readHeader:boolean

set to true if the dss continuation should be read

desiredLength:long

the desired length of chunk. This parameter is ignored when layerB Streaming is doing.

Exceptions
DRDAProtocolException:
standard DRDA protocol exception
readLOBContinuationStreamback to summary
pack-priv ByteArrayInputStream readLOBContinuationStream() throws IOException

This method is used by EXTDTAReaderInputStream to read the next chunk of data. Calling this method finishes layer B streaming if continuation of DSS segment was finished. This lengthless method must be called only when layer B streaming.

Exceptions
IOException:
IOException
readLOBContinuationStreamback to summary
pack-priv ByteArrayInputStream readLOBContinuationStream(final long desiredLength) throws IOException

This method is used by EXTDTAReaderInputStream to read the next chunk of data. Furthermore, when Layer B streaming is carried out, calling this method finishes layer B streaming if continuation of DSS segment was finished.

Parameters
desiredLength:long

the desired length of chunk. This parameter is ignored when layerB Streaming is doing.

Exceptions
IOException:
IOException
readLOBInitStreamback to summary
pack-priv ByteArrayInputStream readLOBInitStream() throws DRDAProtocolException

This method is used by EXTDTAReaderInputStream to read the first chunk of data. This lengthless method must be called only when layer B streaming.

Exceptions
DRDAProtocolException:
standard DRDA protocol exception
readLOBInitStreamback to summary
pack-priv ByteArrayInputStream readLOBInitStream(final long desiredLength) throws DRDAProtocolException

This method is used by EXTDTAReaderInputStream to read the first chunk of data.

Parameters
desiredLength:long

the desired length of chunk. This parameter is ignored when layerB Streaming is doing.

Exceptions
DRDAProtocolException:
standard DRDA protocol exception
readLongback to summary
protected long readLong(int byteOrder) throws DRDAProtocolException

Read platform long value

Returns:long

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readNetworkIntback to summary
protected int readNetworkInt() throws DRDAProtocolException

Read network int value

Returns:int

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readNetworkLongback to summary
protected long readNetworkLong() throws DRDAProtocolException

Read network long value

Returns:long

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readNetworkShortback to summary
protected int readNetworkShort() throws DRDAProtocolException

Read network short value

Returns:int

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readNetworkSixByteLongback to summary
protected long readNetworkSixByteLong() throws DRDAProtocolException

Read network six byte value and put it in a long v

Returns:long

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readReplyDssback to summary
protected void readReplyDss() throws DRDAProtocolException

Read Reply DSS This is used in testing the protocol. We shouldn't see a reply DSS when we are servicing DRDA commands

Exceptions
DRDAProtocolException:
if a protocol error is detected
readShortback to summary
protected short readShort(int byteOrder) throws DRDAProtocolException

Read platform short value

Returns:short

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readSignedNetworkShortback to summary
protected int readSignedNetworkShort() throws DRDAProtocolException

Read signed network short value

Returns:int

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readStringback to summary
protected String readString(int length) throws DRDAProtocolException

Read string value Strings in DRDA protocol are encoded in EBCDIC by default so we need to convert to UCS2

Parameters
length:int

- length of string to read

Returns:String

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readStringback to summary
protected void readString(DRDAString dst, int size, boolean unpad) throws DRDAProtocolException

Read string value into a DRDAString object.

Parameters
dst:DRDAString

destination for the read string

size:int

size (in bytes) of string to read

unpad:boolean

if true, remove padding (trailing spaces)

readStringback to summary
protected String readString(int length, String encoding) throws DRDAProtocolException

Read encoded string value

Parameters
length:int

- length of string to read

Returns:String

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readStringback to summary
protected String readString() throws DRDAProtocolException

Read string value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readStringDataback to summary
protected String readStringData(int length) throws DRDAProtocolException

Read specified length of string value in DDM data with default encoding

Parameters
length:int

- length of string to read

Returns:String

value

Exceptions
DRDAProtocolException:
if a protocol error is detected
readUnsignedByteback to summary
protected int readUnsignedByte() throws DRDAProtocolException

Read byte value and mask out high order bytes before returning

Returns:int

value

setEbcdicCcsidback to summary
protected void setEbcdicCcsid()
setUtf8Ccsidback to summary
protected void setUtf8Ccsid()
shiftBufferback to summary
private void shiftBuffer(byte[] destinationBuffer)

This is a helper method which shifts the buffered bytes from wherever they are in the current buffer to the beginning of different buffer (note these buffers could be the same). State information is updated as needed after the shift.

Parameters
destinationBuffer:byte[]

- buffer to shift data to

skipBytesback to summary
protected void skipBytes(int length) throws DRDAProtocolException

Skip byte string value

Parameters
length:int

- length of string to skip

Exceptions
DRDAProtocolException:
if a protocol error is detected
skipBytesback to summary
protected void skipBytes() throws DRDAProtocolException

Skip byte string value

skipDssback to summary
protected void skipDss() throws DRDAProtocolException

Skip remaining DSS

startLayerBStreamingback to summary
private void startLayerBStreaming()
terminateChainOnErrback to summary
protected boolean terminateChainOnErr()
traceback to summary
private void trace(String msg)

Print a internal trace message