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

pack-priv Class DDMWriter

extends Object
Class Inheritance
Imports
java.io.BufferedOutputStream, .IOException, .InputStream, .ObjectOutputStream, .OutputStream, java.math.BigDecimal, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.CharsetEncoder, .CoderResult, .CodingErrorAction, java.sql.DataTruncation, .SQLException, java.util.Arrays, org.apache.derby.shared.common.reference.DRDAConstants, .Property, org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream, org.apache.derby.iapi.services.property.PropertyUtil, org.apache.derby.shared.common.sanity.SanityManager

The DDMWriter is used to write DRDA protocol. The DRDA Protocol is described in the DDMReader class. For more details, see DRDA Volume 3 (Distributed Data Management(DDM) Architecture (DDS definition)

Field Summary

Modifier and TypeField and Description
private DRDAConnThread
private ByteBuffer
buffer

Output buffer.

private CcsidManager
private int
private static final int
private int
private DssTrace
private EbcdicCcsidManager
private final CharsetEncoder
encoder

Encoder which encodes strings with the server's default encoding.

private boolean
private boolean
private int
private int[]
private static final int
pack-priv static final int
MAX_VARCHAR_BYTE_LENGTH

The maximum length in bytes for strings sent by writeLDString(), which is the maximum unsigned integer value that fits in two bytes.

private int
private int
private byte
private int
private int
pack-priv volatile long
private Utf8CcsidManager

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
beginDss(boolean chainedToNextStructure, int dssType)

Begins a DSS stream (for writing LOB data).

private void
beginDss(int dssType, boolean ensureLen)

Write 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

private int

Returns:

minimum number of extended length bytes needed. 0 indicates no extended length needed.
calculateExtendedLengthByteCount
(long
- size of DDM command
ddmSize
)

Calculate extended length byte count which follows the DSS header for extended DDM.

protected void
clearBuffer()

Clear the entire send buffer

protected void
clearDdm()

Erase all writes for the current ddm and reset the top

protected void
clearDSSesBackToMark(int mark)

Does a logical "clear" of everything written to the buffer after the received mark.

protected byte[]
copyDSSDataToEnd(int start)

Copy Data to End Create a buffer and copy from the position given to the end of data Note that the position given is treated as relative to the current DSS, for there may be other DSS blocks (chained, presumably) which are sitting unwritten in the buffer.

protected void
createDssObject()

Create DSS data object

protected void
createDssReply()

Create DSS reply object

protected void
createDssRequest()

Create DSS request object NOTE: This is _ONLY_ used for testing the protocol (via the ProtocolTestAdapter.java file in this package)!

protected boolean
protected void
endDdm()

End the current DDM

protected void
endDdmAndDss()

End final DDM and DSS header by writing the length in the length location

protected void
endDss(byte chainByte)

End DSS header by writing the length in the length location and setting the chain bit.

protected void
endDss()

End DSS header by writing the length in the length location and setting the chain bit.

private void
endDss(boolean finalizeLength)

End DSS header by writing the length in the length location and setting the chain bit.

private void
ensureLength(int
space required
length
)

Ensure that there is space in the buffer

protected void
finalizeChain(byte currChainByte, OutputStream
Output stream to which we're flushing.
socketOutputStream
)

Finalize the current DSS chain and send it if needed.

private void
finalizeDssLength()

Finish a DSS Layer A object.

protected void
flush()

Flush buffer to outputstream

protected void
flush(OutputStream socketOutputStream)

Flush buffer to specified stream

private void
flushScalarStreamSegment(boolean lastSegment, OutputStream out)

protected byte[]

Returns:

all bytes from startPos up to the current position
getBufferContents
(int
the position of the first byte to copy
startPos
)

Get a copy of a subsequence of the output buffer, starting at the specified position and ending at the current buffer position.

protected int

Returns:

current position
getBufferPosition
()

Get the current position in the output buffer.

private int
getCorrelationID()

Looks at chaining info for previous DSS written, and use that to figure out what the correlation id for the current DSS should be.

protected CcsidManager
protected int

Returns:

current DSS block length
getDSSLength
()

Get the length of the current DSS block we're working on.

private static int
private static boolean

Returns:

true if b is a continuation byte, or false if it is the first byte in a UTF-8 sequence
isContinuationByte
(byte
the byte to check
b
)

Check if a byte value represents a continuation byte in a UTF-8 byte sequence.

private void
markDssAsContinued(boolean forLob)

Mark the DSS that we're currently writing as a continued DSS, which is done by setting the high-order bit to "1", per DDM spec.

protected int
markDSSClearPoint()

Takes note of the location of the most recently completed DSS in the buffer, and then returns the current offset.

private int

Returns:

an upper limit for the number of bytes needed to encode the string
maxEncodedLength
(String
the string to encode
s
)

Find the maximum number of bytes needed to represent the string in the default encoding.

private void
overrideChainByte(int
the position on which the chaining byte is located
pos
,
byte
the chaining byte that overrides the default
chainByte
)

Override the default chaining byte with the chaining byte that is passed in.

protected void
padBytes(byte
value to be written
val
,
int
length to be written
length
)

Write pad bytes using spaceChar

private static int
private static OutputStream
private int
prepScalarStream(boolean chainedWithSameCorrelator, int codePoint, boolean writeNullByte)

prepScalarStream does the following prep for writing stream data: 1.

protected void
reset(DssTrace dssTrace)

reset values for sending next message

protected void
resetChainState()

Reset any chaining state that needs to be reset at time of the send

private void
sendBytes(OutputStream socketOutputStream)

private void
sendBytes(OutputStream socketOutputStream, boolean flashStream)

protected void
setBufferPosition(int
new position
position
)

Change the current position in the output buffer.

protected void
setCMDProtocol()

set protocol to CMD protocol

protected void
protected void
protected void
startDdm(int codePoint)

Mark the location of the length bytes for the collection so they can be updated later

protected void
truncateDSS(int
DSS length
value
)

Truncate the current DSS.

pack-priv void
writeBigDecimal(BigDecimal
BigDecimal to write
b
,
int
Precision of decimal or numeric type
precision
,
int
declared scale
scale
)

Write a Java java.math.BigDecimal to packed decimal bytes.

protected void
writeBoolean(boolean
value to be written
v
)

Write platform boolean

protected void
writeByte(int
byte to be written
value
)

Write byte

protected void
writeBytes(byte[]
byte array to be written
buf
,
int
- length to write
length
)

Write byte array

protected void
writeBytes(byte[]
byte array to be written
buf
,
int
- starting position
start
,
int
- length to write
length
)

Write byte array

protected void
writeBytes(byte[]
byte array to be written
buf
)

Write byte array

pack-priv void
writeCodePoint4Bytes(int
- code point to write
codePoint
,
int
- value to write after code point
value
)

Write code point and 4 bytes

protected void
writeDouble(double
value to be written
v
)

Write platform double

protected void
protected void
writeFloat(float
value to be written
v
)

Write platform float

protected void
writeInt(int
value to be written
v
)

Write platform int

protected void
writeLDBytes(byte[] buf)

protected void
writeLDBytes(byte[] buf, int index)

protected void
writeLDString(String
value to be written with integer
s
)

Write length delimited string

protected void
writeLDString(String
value to be written with integer
s
,
int
column index to put in warning
index
,
DRDAStatement
the executing statement (null if not invoked as part of statement execution)
stmt
,
boolean
true if the value written is for an output parameter in a procedure call
isParameter
)

Write length delimited string

pack-priv void
writeLengthCodePoint(int length, int codePoint)

protected void
writeLong(long
value to be written
v
)

Write platform long

protected void
writeNetworkInt(int
value to be written
value
)

Write network int

protected void
writeNetworkShort(int
value to be written
value
)

Write network short

pack-priv void
writeScalar1Byte(int
- code point to write
codePoint
,
int
- value to write after code point
value
)

Write scalar 1 byte object includes length, codepoint and value

protected void
writeScalar2Bytes(int
- code point to write
codePoint
,
int
- value to write after code point
value
)

Write scalar 2 byte object includes length, codepoint and value

protected void
writeScalar2Bytes(int value)

protected void
writeScalarBytes(int
- code point to write
codePoint
,
byte[]
- byte array to be written
buf
)

Write scalar byte array object includes length, codepoint and value

protected void
writeScalarHeader(int
- code point to write
codePoint
,
int
- length of object data
dataLength
)

Write scalar object header includes length and codepoint

protected void
writeScalarPaddedBytes(int
- code point to write
codePoint
,
byte[]
- byte array to be written
buf
,
int
- length to pad string to
paddedLength
,
byte
- byte to be used for padding
padByte
)

Write padded scalar byte array object includes length, codepoint and value

protected void
writeScalarPaddedBytes(byte[]
- byte array to be written
buf
,
int
- length to pad string to
paddedLength
,
byte
- byte to be used for padding
padByte
)

Write padded scalar byte array object value

pack-priv void
writeScalarPaddedString(int
- code point to write
codePoint
,
String
- string to be written
string
,
int
- length to pad string to
paddedLength
)

Write padded scalar string object includes length, codepoint and value the string is converted into the appropriate codeset (EBCDIC)

protected void
writeScalarPaddedString(DRDAString
string to be written
drdaString
,
int
length to pad string to
paddedLength
)

Write padded scalar DRDAString object value.

protected void
writeScalarStream(boolean chainedWithSameCorrelator, int codePoint, EXTDTAInputStream in, boolean writeNullByte)

pack-priv void
writeScalarString(int
- code point to write
codePoint
,
String
- string to be written
string
)

Write scalar string object includes length, codepoint and value the string is converted into the appropriate codeset (EBCDIC)

protected void
writeShort(int
value to be written
v
)

Write platform short

protected void
writeShort(boolean
boolean value true = 1 false = 0
b
)

Write boolean as short

protected void
writeString(String
value to be written
s
)

Write string with default encoding

protected void
writeUDT(Object
object to be written
val
,
int index)

Write a value of a user defined type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

agentback to summary
private DRDAConnThread agent
bufferback to summary
private ByteBuffer buffer

Output buffer.

ccsidManagerback to summary
private CcsidManager ccsidManager
correlationIDback to summary
private int correlationID
DEFAULT_BUFFER_SIZEback to summary
private static final int DEFAULT_BUFFER_SIZE
dssLengthLocationback to summary
private int dssLengthLocation
dssTraceback to summary
private DssTrace dssTrace
ebcdicCcsidManagerback to summary
private EbcdicCcsidManager ebcdicCcsidManager
encoderback to summary
private final CharsetEncoder encoder

Encoder which encodes strings with the server's default encoding.

isContinuationDssback to summary
private boolean isContinuationDss
isDRDAProtocolback to summary
private boolean isDRDAProtocol
lastDSSBeforeMarkback to summary
private int lastDSSBeforeMark
markStackback to summary
private int[] markStack
MAX_MARKS_NESTINGback to summary
private static final int MAX_MARKS_NESTING
MAX_VARCHAR_BYTE_LENGTHback to summary
pack-priv static final int MAX_VARCHAR_BYTE_LENGTH

The maximum length in bytes for strings sent by writeLDString(), which is the maximum unsigned integer value that fits in two bytes.

nextCorrelationIDback to summary
private int nextCorrelationID
prevHdrLocationback to summary
private int prevHdrLocation
previousChainByteback to summary
private byte previousChainByte
previousCorrIdback to summary
private int previousCorrId
topback to summary
private int top
totalByteCountback to summary
pack-priv volatile long totalByteCount
utf8CcsidManagerback to summary
private Utf8CcsidManager utf8CcsidManager

Constructor Detail

DDMWriterback to summary
pack-priv DDMWriter(DRDAConnThread agent, DssTrace dssTrace)

Method Detail

beginDssback to summary
private void beginDss(boolean chainedToNextStructure, int dssType)

Begins a DSS stream (for writing LOB data).

beginDssback to summary
private void beginDss(int dssType, boolean ensureLen)

Write 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

calculateExtendedLengthByteCountback to summary
private int calculateExtendedLengthByteCount(long ddmSize)

Calculate extended length byte count which follows the DSS header for extended DDM.

Parameters
ddmSize:long

- size of DDM command

Returns:int

minimum number of extended length bytes needed. 0 indicates no extended length needed.

clearBufferback to summary
protected void clearBuffer()

Clear the entire send buffer

clearDdmback to summary
protected void clearDdm()

Erase all writes for the current ddm and reset the top

clearDSSesBackToMarkback to summary
protected void clearDSSesBackToMark(int mark)

Does a logical "clear" of everything written to the buffer after the received mark. It's assumed that this method will be used in error cases when we've started writing one or more DSSes, but then hit an error and need to back out. After backing out, we'll always need to write _something_ back to the client to indicate an error (typically, we just write an SQLCARD) but what exactly gets written is handled in DRDAConnThread. Here, we just do the necessary prep so that whatever comes next will succeed.

copyDSSDataToEndback to summary
protected byte[] copyDSSDataToEnd(int start)

Copy Data to End Create a buffer and copy from the position given to the end of data Note that the position given is treated as relative to the current DSS, for there may be other DSS blocks (chained, presumably) which are sitting unwritten in the buffer. The caller doesn't know this, though, and works only with the current DSS. getDSSLength, copyDSSDataToEnd, and truncateDSS work together to provide a sub-protocol for DRDAConnThread to use in its implementation of the LMTBLKPRC protocol. They enable the caller to determine when it has written too much data into the current DSS, to reclaim the extra data that won't fit, and to truncate that extra data once it has been reclaimed and stored elsewhere. Note that this support only works for the current DSS. Earlier, chained DSS blocks cannot be accessed using these methods. For additional background information, the interested reader should investigate bugs DERBY-491 and 492 at: http://issues.apache.org/jira/browse/DERBY-491 and http://issues.apache.org/jira/browse/DERBY-492

createDssObjectback to summary
protected void createDssObject()

Create DSS data object

createDssReplyback to summary
protected void createDssReply()

Create DSS reply object

createDssRequestback to summary
protected void createDssRequest()

Create DSS request object NOTE: This is _ONLY_ used for testing the protocol (via the ProtocolTestAdapter.java file in this package)! We should never create a DSS request in normal DRDA processing (we should only create DSS replies and DSS objects).

doesRequestContainDataback to summary
protected boolean doesRequestContainData()
endDdmback to summary
protected void endDdm()

End the current DDM

endDdmAndDssback to summary
protected void endDdmAndDss()

End final DDM and DSS header by writing the length in the length location

endDssback to summary
protected void endDss(byte chainByte)

End DSS header by writing the length in the length location and setting the chain bit. Unlike the other two endDss methods, this one overrides the default chaining byte (which is set in beginDss) with the chaining byte that is passed in.

Note

This method is only used in association with createDssRequest, and thus is for TESTING purposes only (via ProtocolTestAdpater.java). No calls should be made to this method in normal DRDA processing (because for normal processing, chaining must be determined automatically based on DSS requests).

endDssback to summary
protected void endDss()

End DSS header by writing the length in the length location and setting the chain bit.

endDssback to summary
private void endDss(boolean finalizeLength)

End DSS header by writing the length in the length location and setting the chain bit.

ensureLengthback to summary
private void ensureLength(int length)

Ensure that there is space in the buffer

Parameters
length:int

space required

finalizeChainback to summary
protected void finalizeChain(byte currChainByte, OutputStream socketOutputStream) throws DRDAProtocolException

Finalize the current DSS chain and send it if needed. Updates the chaining state of the most recently-written- to-buffer DSS to correspond to the most recently-read- from-client request. If that chaining state indicates we've reached the end of a chain, then we go ahead and send the buffer across the wire.

Parameters
socketOutputStream:OutputStream

Output stream to which we're flushing.

finalizeDssLengthback to summary
private void finalizeDssLength()

Finish a DSS Layer A object. The length of dss object will be calculated based on the difference between the start of the dss, saved on the beginDss call, and the current offset into the buffer which marks the end of the data. In the event the length requires the use of continuation Dss headers, one for each 32k chunk of data, the data will be shifted and the continuation headers will be inserted with the correct values as needed.

flushback to summary
protected void flush() throws IOException

Flush buffer to outputstream

flushback to summary
protected void flush(OutputStream socketOutputStream) throws IOException

Flush buffer to specified stream

flushScalarStreamSegmentback to summary
private void flushScalarStreamSegment(boolean lastSegment, OutputStream out) throws DRDAProtocolException
getBufferContentsback to summary
protected byte[] getBufferContents(int startPos)

Get a copy of a subsequence of the output buffer, starting at the specified position and ending at the current buffer position.

Parameters
startPos:int

the position of the first byte to copy

Returns:byte[]

all bytes from startPos up to the current position

getBufferPositionback to summary
protected int getBufferPosition()

Get the current position in the output buffer.

Returns:int

current position

getCorrelationIDback to summary
private int getCorrelationID()

Looks at chaining info for previous DSS written, and use that to figure out what the correlation id for the current DSS should be. Return that correlation id.

getCurrentCcsidManagerback to summary
protected CcsidManager getCurrentCcsidManager()
getDSSLengthback to summary
protected int getDSSLength()

Get the length of the current DSS block we're working on. This is used by the LMTBLKPRC protocol, which does its own conversational blocking protocol above the layer of the DRDA blocking. The LMTBLKPRC implementation (in DRDAConnThread) needs to be able to truncate a DSS block when splitting a QRYDTA response.

Returns:int

current DSS block length

getLayerBStreamingBufferSizeback to summary
private static int getLayerBStreamingBufferSize()
isContinuationByteback to summary
private static boolean isContinuationByte(byte b)

Check if a byte value represents a continuation byte in a UTF-8 byte sequence. Continuation bytes in UTF-8 always match the bit pattern 10xxxxxx.

Parameters
b:byte

the byte to check

Returns:boolean

true if b is a continuation byte, or false if it is the first byte in a UTF-8 sequence

markDssAsContinuedback to summary
private void markDssAsContinued(boolean forLob)

Mark the DSS that we're currently writing as a continued DSS, which is done by setting the high-order bit to "1", per DDM spec. This means: 1. One or more continuation DSSes will immediately follow the current (continued) DSS. 2. All continuation DSSes will have a 2-byte continuation header, followed by data; in other words, chaining state, correlation id, dss format info, and code point will NOT be included. All of that info is present ONLY in the FIRST DSS in the list of continued DSSes.

Note

A DSS can be a "continuation" DSS _and_ a "continued" DSS at the same time. However, the FIRST DSS to be continued canNOT be a continuation DSS.

markDSSClearPointback to summary
protected int markDSSClearPoint()

Takes note of the location of the most recently completed DSS in the buffer, and then returns the current offset. This method is used in conjunction with "clearDSSesBackToMark" to allow for DRDAConnThread to "back-out" DSSes in the event of errors.

maxEncodedLengthback to summary
private int maxEncodedLength(String s)

Find the maximum number of bytes needed to represent the string in the default encoding.

Parameters
s:String

the string to encode

Returns:int

an upper limit for the number of bytes needed to encode the string

overrideChainByteback to summary
private void overrideChainByte(int pos, byte chainByte)

Override the default chaining byte with the chaining byte that is passed in.

Parameters
pos:int

the position on which the chaining byte is located

chainByte:byte

the chaining byte that overrides the default

padBytesback to summary
protected void padBytes(byte val, int length)

Write pad bytes using spaceChar

Parameters
val:byte

value to be written

length:int

length to be written

peekStreamback to summary
private static int peekStream(InputStream in) throws IOException
placeLayerBStreamingBufferback to summary
private static OutputStream placeLayerBStreamingBuffer(OutputStream original)
prepScalarStreamback to summary
private int prepScalarStream(boolean chainedWithSameCorrelator, int codePoint, boolean writeNullByte) throws DRDAProtocolException

prepScalarStream does the following prep for writing stream data: 1. Flushes an existing DSS segment, if necessary 2. Determines if extended length bytes are needed 3. Creates a new DSS/DDM header and a null byte indicator, if applicable If value of length was less than 0, this method processes streaming as Layer B Streaming. cf. page 315 of specification of DRDA, Version 3, Volume 3

resetback to summary
protected void reset(DssTrace dssTrace)

reset values for sending next message

resetChainStateback to summary
protected void resetChainState()

Reset any chaining state that needs to be reset at time of the send

sendBytesback to summary
private void sendBytes(OutputStream socketOutputStream) throws IOException
sendBytesback to summary
private void sendBytes(OutputStream socketOutputStream, boolean flashStream) throws IOException
setBufferPositionback to summary
protected void setBufferPosition(int position)

Change the current position in the output buffer.

Parameters
position:int

new position

setCMDProtocolback to summary
protected void setCMDProtocol()

set protocol to CMD protocol

setEbcdicCcsidback to summary
protected void setEbcdicCcsid()
setUtf8Ccsidback to summary
protected void setUtf8Ccsid()
startDdmback to summary
protected void startDdm(int codePoint)

Mark the location of the length bytes for the collection so they can be updated later

truncateDSSback to summary
protected void truncateDSS(int value)

Truncate the current DSS. Before making this call, you should ensure that you have copied the data to be truncated somewhere else, by calling copyDSSDataToEnd

Parameters
value:int

DSS length

writeBigDecimalback to summary
pack-priv void writeBigDecimal(BigDecimal b, int precision, int scale) throws SQLException

Write a Java java.math.BigDecimal to packed decimal bytes.

Parameters
b:BigDecimal

BigDecimal to write

precision:int

Precision of decimal or numeric type

scale:int

declared scale

Exceptions
SQLException:
Thrown if # digits > 31
writeBooleanback to summary
protected void writeBoolean(boolean v)

Write platform boolean

Parameters
v:boolean

value to be written

writeByteback to summary
protected void writeByte(int value)

Write byte

Parameters
value:int

byte to be written

writeBytesback to summary
protected void writeBytes(byte[] buf, int length)

Write byte array

Parameters
buf:byte[]

byte array to be written

length:int

- length to write

writeBytesback to summary
protected void writeBytes(byte[] buf, int start, int length)

Write byte array

Parameters
buf:byte[]

byte array to be written

start:int

- starting position

length:int

- length to write

writeBytesback to summary
protected void writeBytes(byte[] buf)

Write byte array

Parameters
buf:byte[]

byte array to be written

writeCodePoint4Bytesback to summary
pack-priv void writeCodePoint4Bytes(int codePoint, int value)

Write code point and 4 bytes

Parameters
codePoint:int

- code point to write

value:int

- value to write after code point

writeDoubleback to summary
protected void writeDouble(double v)

Write platform double

Parameters
v:double

value to be written

writeExtendedLengthback to summary
protected void writeExtendedLength(long size)
writeFloatback to summary
protected void writeFloat(float v)

Write platform float

Parameters
v:float

value to be written

writeIntback to summary
protected void writeInt(int v)

Write platform int

Parameters
v:int

value to be written

writeLDBytesback to summary
protected void writeLDBytes(byte[] buf)
writeLDBytesback to summary
protected void writeLDBytes(byte[] buf, int index)
writeLDStringback to summary
protected void writeLDString(String s) throws DRDAProtocolException

Write length delimited string

Parameters
s:String

value to be written with integer

writeLDStringback to summary
protected void writeLDString(String s, int index, DRDAStatement stmt, boolean isParameter) throws DRDAProtocolException

Write length delimited string

Parameters
s:String

value to be written with integer

index:int

column index to put in warning

stmt:DRDAStatement

the executing statement (null if not invoked as part of statement execution)

isParameter:boolean

true if the value written is for an output parameter in a procedure call

writeLengthCodePointback to summary
pack-priv void writeLengthCodePoint(int length, int codePoint)
writeLongback to summary
protected void writeLong(long v)

Write platform long

Parameters
v:long

value to be written

writeNetworkIntback to summary
protected void writeNetworkInt(int value)

Write network int

Parameters
value:int

value to be written

writeNetworkShortback to summary
protected void writeNetworkShort(int value)

Write network short

Parameters
value:int

value to be written

writeScalar1Byteback to summary
pack-priv void writeScalar1Byte(int codePoint, int value)

Write scalar 1 byte object includes length, codepoint and value

Parameters
codePoint:int

- code point to write

value:int

- value to write after code point

writeScalar2Bytesback to summary
protected void writeScalar2Bytes(int codePoint, int value)

Write scalar 2 byte object includes length, codepoint and value

Parameters
codePoint:int

- code point to write

value:int

- value to write after code point

writeScalar2Bytesback to summary
protected void writeScalar2Bytes(int value)
writeScalarBytesback to summary
protected void writeScalarBytes(int codePoint, byte[] buf)

Write scalar byte array object includes length, codepoint and value

Parameters
codePoint:int

- code point to write

buf:byte[]

- byte array to be written

writeScalarHeaderback to summary
protected void writeScalarHeader(int codePoint, int dataLength)

Write scalar object header includes length and codepoint

Parameters
codePoint:int

- code point to write

dataLength:int

- length of object data

writeScalarPaddedBytesback to summary
protected void writeScalarPaddedBytes(int codePoint, byte[] buf, int paddedLength, byte padByte)

Write padded scalar byte array object includes length, codepoint and value

Parameters
codePoint:int

- code point to write

buf:byte[]

- byte array to be written

paddedLength:int

- length to pad string to

padByte:byte

- byte to be used for padding

writeScalarPaddedBytesback to summary
protected void writeScalarPaddedBytes(byte[] buf, int paddedLength, byte padByte)

Write padded scalar byte array object value

Parameters
buf:byte[]

- byte array to be written

paddedLength:int

- length to pad string to

padByte:byte

- byte to be used for padding

writeScalarPaddedStringback to summary
pack-priv void writeScalarPaddedString(int codePoint, String string, int paddedLength)

Write padded scalar string object includes length, codepoint and value the string is converted into the appropriate codeset (EBCDIC)

Parameters
codePoint:int

- code point to write

string:String

- string to be written

paddedLength:int

- length to pad string to

writeScalarPaddedStringback to summary
protected void writeScalarPaddedString(DRDAString drdaString, int paddedLength)

Write padded scalar DRDAString object value. The string is converted into the appropriate codeset.

Parameters
drdaString:DRDAString

string to be written

paddedLength:int

length to pad string to

writeScalarStreamback to summary
protected void writeScalarStream(boolean chainedWithSameCorrelator, int codePoint, EXTDTAInputStream in, boolean writeNullByte) throws DRDAProtocolException
writeScalarStringback to summary
pack-priv void writeScalarString(int codePoint, String string)

Write scalar string object includes length, codepoint and value the string is converted into the appropriate codeset (EBCDIC)

Parameters
codePoint:int

- code point to write

string:String

- string to be written

writeShortback to summary
protected void writeShort(int v)

Write platform short

Parameters
v:int

value to be written

writeShortback to summary
protected void writeShort(boolean b)

Write boolean as short

Parameters
b:boolean

boolean value true = 1 false = 0

writeStringback to summary
protected void writeString(String s) throws DRDAProtocolException

Write string with default encoding

Parameters
s:String

value to be written

writeUDTback to summary
protected void writeUDT(Object val, int index) throws DRDAProtocolException

Write a value of a user defined type.

Parameters
val:Object

object to be written