Class LayerBStreamedEXTDTAReaderInputStream
java.lang.Object
java.io.InputStream
org.apache.derby.impl.drda.EXTDTAReaderInputStream
org.apache.derby.impl.drda.LayerBStreamedEXTDTAReaderInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
Implementation of InputStream which get EXTDTA from the DDMReader.
This class can be used to stream LOBs from Network client to the
Network server.
Furthermore, this class is used when layer B streaming is carried out and
expects corresponding DDMReader start layer B streaming
when the object of this class is instantiated.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteArrayInputStreamCurrent data bufferprivate final DDMReaderDDMReader.Fields inherited from class EXTDTAReaderInputStream
isLayerBStream, readStatusByte -
Constructor Summary
ConstructorsConstructorDescriptionLayerBStreamedEXTDTAReaderInputStream(DDMReader reader, boolean readStatusByte) Constructor -
Method Summary
Modifier and TypeMethodDescriptionfinal intReturns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.protected voidPerforms necessary clean up when an error is signalled by the client.final intread()Reads the next byte of data from the input stream.final intread(byte[] b, int off, int len) Reads up tolenbytes of data from the input stream into an array of bytes.Methods inherited from class EXTDTAReaderInputStream
checkStatus, getStatus, isLayerBStream, isStatusSet, setSuppressException, throwEXTDTATransferExceptionMethods inherited from class InputStream
close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
reader
DDMReader. Used to get more data. -
currentBuffer
Current data buffer
-
-
Constructor Details
-
LayerBStreamedEXTDTAReaderInputStream
LayerBStreamedEXTDTAReaderInputStream(DDMReader reader, boolean readStatusByte) throws DRDAProtocolException Constructor- Parameters:
reader- The reader to get data fromreadStatusByte- whether or not to read the trailing Derby-specific EXTDTA stream status byte- Throws:
DRDAProtocolException- if thrown while initializing current buffer.
-
-
Method Details
-
read
Reads the next byte of data from the input stream.This subclass of InputStream implements this method by reading the next byte from the current buffer. If there is more data, it will be requested a new buffer from the DDMReader.
- Specified by:
readin classInputStream- Returns:
- the next byte of data, or
-1if the end of the stream is reached. - Throws:
IOException- if an I/O error occurs.- See Also:
-
read
Reads up tolenbytes of data from the input stream into an array of bytes. An attempt is made to read as many aslenbytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer. This subclass implements this method by calling this method on the current buffer, which is an instance of ByteArrayInputStream. If the current buffer does not have any data, it will be requested a new buffer from the DDMReader.- Overrides:
readin classInputStream- Parameters:
b- the buffer into which the data is read.off- the start offset in arraybat which the data is written.len- the maximum number of bytes to read.- Returns:
- the total number of bytes read into the buffer, or
-1if there is no more data because the end of the stream has been reached. - Throws:
IOException- if an I/O error occurs.NullPointerException- ifbisnull.- See Also:
-
available
public final int available()Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.This subclass implements this method by calling available on the current buffer, which is a ByteInputStreamReader.
- Overrides:
availablein classInputStream- Returns:
- the number of bytes that can be read from this input stream without blocking.
-
onClientSideStreamingError
protected void onClientSideStreamingError()Description copied from class:EXTDTAReaderInputStreamPerforms necessary clean up when an error is signalled by the client.- Specified by:
onClientSideStreamingErrorin classEXTDTAReaderInputStream
-