Package org.apache.derby.iapi.types
Interface StreamHeaderGenerator
-
- All Known Implementing Classes:
CharStreamHeaderGenerator,ClobStreamHeaderGenerator
public interface StreamHeaderGeneratorGenerates stream headers encoding the length of the stream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexpectsCharCount()Tells if the header encodes a character or byte count.intgenerateInto(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.intgenerateInto(java.io.ObjectOutput out, long valueLength)Generates the header for the specified length and writes it into the destination stream.intgetMaxHeaderLength()Returns the maximum length of the header.intwriteEOF(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.intwriteEOF(java.io.ObjectOutput out, long valueLength)Writes a Derby-specific end-of-stream marker to the destination stream for the specified length, if required.
-
-
-
Method Detail
-
expectsCharCount
boolean expectsCharCount()
Tells if the header encodes a character or byte count.- Returns:
trueif the character count is encoded into the header,falseif the byte count is encoded into the header.
-
generateInto
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- the buffer to write intooffset- starting offset in the buffervalueLength- the length of the stream, can be in either bytes or characters depending on the header format- Returns:
- The number of bytes written into the buffer.
-
generateInto
int generateInto(java.io.ObjectOutput out, long valueLength) throws java.io.IOExceptionGenerates the header for the specified length and writes it into the destination stream.- Parameters:
out- the destination streamvalueLength- the length of the stream, can be in either bytes or characters depending on the header format- Returns:
- The number of bytes written to the destination stream.
- Throws:
java.io.IOException- if writing to the destination stream fails
-
writeEOF
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- the buffer to write intooffset- starting offset in the buffervalueLength- the length of the stream, can be in either bytes or characters depending on the header format- Returns:
- Number of bytes written (zero or more).
-
writeEOF
int writeEOF(java.io.ObjectOutput out, long valueLength) throws java.io.IOExceptionWrites a Derby-specific end-of-stream marker to the destination stream for the specified length, if required.- Parameters:
out- the destination streamvalueLength- the length of the stream, can be in either bytes or characters depending on the header format- Returns:
- Number of bytes written (zero or more).
- Throws:
java.io.IOException- if writing to the destination stream fails
-
getMaxHeaderLength
int getMaxHeaderLength()
Returns the maximum length of the header.- Returns:
- Max header length in bytes.
-
-