org.apache.derby.iapi.types
Interface StreamHeaderGenerator

All Known Implementing Classes:
CharStreamHeaderGenerator, ClobStreamHeaderGenerator

public interface StreamHeaderGenerator

Generates stream headers encoding the length of the stream.


Field Summary
static byte[] DERBY_EOF_MARKER
          The Derby-specific end-of-stream marker.
 
Method Summary
 boolean expectsCharCount()
          Tells if the header encodes a character or byte count.
 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.
 int generateInto(java.io.ObjectOutput out, long valueLength)
          Generates the header for the specified length and writes it into the destination stream.
 int getMaxHeaderLength()
          Returns the maximum length of the header.
 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.
 int writeEOF(java.io.ObjectOutput out, long valueLength)
          Writes a Derby-specific end-of-stream marker to the destination stream for the specified length, if required.
 

Field Detail

DERBY_EOF_MARKER

static final byte[] DERBY_EOF_MARKER
The Derby-specific end-of-stream marker.

Method Detail

expectsCharCount

boolean expectsCharCount()
Tells if the header encodes a character or byte count.

Returns:
true if the character count is encoded into the header, false if 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 into
offset - starting offset in the buffer
valueLength - 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.IOException
Generates the header for the specified length and writes it into the destination stream.

Parameters:
out - the destination stream
valueLength - 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 into
offset - starting offset in the buffer
valueLength - 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.IOException
Writes a Derby-specific end-of-stream marker to the destination stream for the specified length, if required.

Parameters:
out - the destination stream
valueLength - 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.

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.