If the length of the stream is known then it is encoded
as the first bytes in the stream in the defined format.
If the length is unknown then the first four bytes will
be zero, indicating unknown length.
Note
This stream cannot be re-used. Once end of file is reached, the next read call will throw an EOFException
SQLBinary
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | encodedLength
Encoding of the length in bytes which will be seen as the first encodedLength.length bytes of this stream. |
| private int | encodedOffset
Number of bytes of length encoding. |
| private boolean | |
| private final int | length
The length of the stream. |
| private final int | maximumLength
The maximum allowed length for the stream. |
| private final String | typeName
The type of the column the stream is inserted into. |
| Access | Constructor and Description |
|---|---|
| public | RawToBinaryFormatStream(InputStream
application's raw binary stream passed into JDBC layer in, int length of the stream length)Create a binary on-disk stream from the given |
| public | RawToBinaryFormatStream(InputStream
the application stream in, int maximum length of the column data is inserted into maximumLength, String type name for the column data is inserted into typeName)Create a binary on-disk stream from the given |
| Modifier and Type | Method and Description |
|---|---|
| private void | checkSufficientData()
JDBC 3.0 (from tutorial book) requires that an input stream has the correct number of bytes in the stream. |
| public int | read()
Overrides org. Read from the wrapped stream prepending the intial bytes if needed. |
| public int | read(byte[]
the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides org. Read from the wrapped stream prepending the intial bytes if needed. |
| encodedLength | back to summary |
|---|---|
| private byte[] encodedLength Encoding of the length in bytes which will be seen as the first encodedLength.length bytes of this stream. | |
| encodedOffset | back to summary |
|---|---|
| private int encodedOffset Number of bytes of length encoding. | |
| eof | back to summary |
|---|---|
| private boolean eof | |
| length | back to summary |
|---|---|
| private final int length The length of the stream. Unknown if less than 0. | |
| maximumLength | back to summary |
|---|---|
| private final int maximumLength The maximum allowed length for the stream. No limit if less than 0. | |
| typeName | back to summary |
|---|---|
| private final String typeName The type of the column the stream is inserted into.
Used for length less streams, | |
| RawToBinaryFormatStream | back to summary |
|---|---|
| public RawToBinaryFormatStream(InputStream in, int length) Create a binary on-disk stream from the given
| |
| RawToBinaryFormatStream | back to summary |
|---|---|
| public RawToBinaryFormatStream(InputStream in, int maximumLength, String typeName) Create a binary on-disk stream from the given
| |
| checkSufficientData | back to summary |
|---|---|
| private void checkSufficientData() throws IOException JDBC 3.0 (from tutorial book) requires that an input stream has the correct number of bytes in the stream. | |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides org. Read from the wrapped stream prepending the intial bytes if needed. If stream has been read, and eof reached, in that case any subsequent read will throw an EOFException
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides org. Read from the wrapped stream prepending the intial bytes if needed. If stream has been read, and eof reached, in that case any subsequent read will throw an EOFException
| |