The stream header encodes the byte length of the stream. Since two bytes are used for the header, the maximum encodable length is 65535 bytes. There are three special cases, all handled by encoding zero into the header and possibly appending an EOF-marker to the stream:
out.writeByte((byte)(byteLength >>> 8));
out.writeByte((byte)(byteLength >>> 0));
| Modifier and Type | Field and Description |
|---|---|
| private static final byte[] | DERBY_EOF_MARKER
The Derby-specific end-of-stream marker. |
| private static final int | MAX_ENCODABLE_LENGTH
The maximum length that can be encoded by the header. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: false.Implements org. A byte count is expected. |
| public int | Returns: The number of bytes written into the buffer.the buffer to write into buffer, int starting offset in the buffer offset, long the length to encode in the header byteLength)Implements org. 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.the destination stream out, long the byte length to encode in the header byteLength)Implements org. Generates the header for the specified length. |
| public int | Returns: Maximum header length in bytes.Implements org. Returns the maximum header length. |
| public int | Returns: Number of bytes written (zero or more).the buffer to write into buffer, int starting offset in the buffer offset, long the byte length of the stream byteLength)Implements org. Writes a Derby-specific end-of-stream marker to the buffer for a stream of the specified byte length, if required. |
| public int | Returns: Number of bytes written (zero or more).the destination stream out, long the length of the stream byteLength)Implements org. Writes a Derby-specific end-of-stream marker to the destination stream for the specified byte length, if required. |
| public static int | writeEOFMarker(byte[] buffer, int offset)
Write the EOF marker to a byte array and return the EOF marker's length |
| public static int | writeEOFMarker(ObjectOutput out)
Write the EOF marker to an Object stream and return the EOF marker's length |
| DERBY_EOF_MARKER | back to summary |
|---|---|
| private static final byte[] DERBY_EOF_MARKER The Derby-specific end-of-stream marker. | |
| MAX_ENCODABLE_LENGTH | back to summary |
|---|---|
| private static final int MAX_ENCODABLE_LENGTH The maximum length that can be encoded by the header. | |
| CharStreamHeaderGenerator | back to summary |
|---|---|
| public CharStreamHeaderGenerator() | |
| expectsCharCount | back to summary |
|---|---|
| public boolean expectsCharCount() Implements org. A byte count is expected.
| |
| generateInto | back to summary |
|---|---|
| public int generateInto(byte[] buffer, int offset, long byteLength) Implements org. Generates the header for the specified length and writes it into the provided buffer, starting at the specified offset.
| |
| generateInto | back to summary |
|---|---|
| public int generateInto(ObjectOutput out, long byteLength) throws IOException Implements org. Generates the header for the specified length.
| |
| getMaxHeaderLength | back to summary |
|---|---|
| public int getMaxHeaderLength() Implements org. Returns the maximum header length.
| |
| writeEOF | back to summary |
|---|---|
| public int writeEOF(byte[] buffer, int offset, long byteLength) Implements org. Writes a Derby-specific end-of-stream marker to the buffer for a stream of the specified byte length, if required.
| |
| writeEOF | back to summary |
|---|---|
| public int writeEOF(ObjectOutput out, long byteLength) throws IOException Implements org. Writes a Derby-specific end-of-stream marker to the destination stream for the specified byte length, if required.
| |
| writeEOFMarker | back to summary |
|---|---|
| public static int writeEOFMarker(byte[] buffer, int offset) Write the EOF marker to a byte array and return the EOF marker's length | |
| writeEOFMarker | back to summary |
|---|---|
| public static int writeEOFMarker(ObjectOutput out) throws IOException Write the EOF marker to an Object stream and return the EOF marker's length | |