Top Description Methods
org.apache.derby.iapi.types

public Interface StreamHeaderGenerator

Known Direct Implementers
org.apache.derby.iapi.types.CharStreamHeaderGenerator, org.apache.derby.iapi.types.ClobStreamHeaderGenerator
Imports
java.io.IOException, .ObjectOutput

Generates stream headers encoding the length of the stream.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the character count is encoded into the header, false if the byte count is encoded into the header.
expectsCharCount
()

Tells if the header encodes a character or byte count.

public int

Returns:

The number of bytes written into the buffer.
generateInto
(byte[]
the buffer to write into
buf
,
int
starting offset in the buffer
offset
,
long
the length of the stream, can be in either bytes or characters depending on the header format
valueLength
)

Generates the header for the specified length and writes it into the provided buffer, starting at the specified offset.

public int

Returns:

The number of bytes written to the destination stream.
generateInto
(ObjectOutput
the destination stream
out
,
long
the length of the stream, can be in either bytes or characters depending on the header format
valueLength
)

Generates the header for the specified length and writes it into the destination stream.

public int

Returns:

Max header length in bytes.
getMaxHeaderLength
()

Returns the maximum length of the header.

public int

Returns:

Number of bytes written (zero or more).
writeEOF
(byte[]
the buffer to write into
buffer
,
int
starting offset in the buffer
offset
,
long
the length of the stream, can be in either bytes or characters depending on the header format
valueLength
)

Writes a Derby-specific end-of-stream marker to the buffer for a stream of the specified length, if required.

public int

Returns:

Number of bytes written (zero or more).
writeEOF
(ObjectOutput
the destination stream
out
,
long
the length of the stream, can be in either bytes or characters depending on the header format
valueLength
)

Writes a Derby-specific end-of-stream marker to the destination stream for the specified length, if required.

Method Detail

expectsCharCountback to summary
public boolean expectsCharCount()

Tells if the header encodes a character or byte count.

Returns:boolean

true if the character count is encoded into the header, false if the byte count is encoded into the header.

generateIntoback to summary
public int generateInto(byte[] buf, int offset, long valueLength)

Generates the header for the specified length and writes it into the provided buffer, starting at the specified offset.

Parameters
buf:byte[]

the buffer to write into

offset:int

starting offset in the buffer

valueLength:long

the length of the stream, can be in either bytes or characters depending on the header format

Returns:int

The number of bytes written into the buffer.

generateIntoback to summary
public int generateInto(ObjectOutput out, long valueLength) throws IOException

Generates the header for the specified length and writes it into the destination stream.

Parameters
out:ObjectOutput

the destination stream

valueLength:long

the length of the stream, can be in either bytes or characters depending on the header format

Returns:int

The number of bytes written to the destination stream.

Exceptions
IOException:
if writing to the destination stream fails
getMaxHeaderLengthback to summary
public int getMaxHeaderLength()

Returns the maximum length of the header.

Returns:int

Max header length in bytes.

writeEOFback to summary
public int writeEOF(byte[] buffer, int offset, long valueLength)

Writes a Derby-specific end-of-stream marker to the buffer for a stream of the specified length, if required.

Parameters
buffer:byte[]

the buffer to write into

offset:int

starting offset in the buffer

valueLength:long

the length of the stream, can be in either bytes or characters depending on the header format

Returns:int

Number of bytes written (zero or more).

writeEOFback to summary
public int writeEOF(ObjectOutput out, long valueLength) throws IOException

Writes a Derby-specific end-of-stream marker to the destination stream for the specified length, if required.

Parameters
out:ObjectOutput

the destination stream

valueLength:long

the length of the stream, can be in either bytes or characters depending on the header format

Returns:int

Number of bytes written (zero or more).

Exceptions
IOException:
if writing to the destination stream fails