Top Description Fields Constructors Methods
com.mysql.cj.protocol.x

public Class ContinuousInputStream

extends FilterInputStream
Class Inheritance
Imports
java.io.FilterInputStream, .IOException, .InputStream, java.util.LinkedList, .Queue

An InputStream wrapper that reads from a queue of underlying InputStreams, giving the impression that all data is coming from a single, continuous, source.

Field Summary

Modifier and TypeField and Description
private boolean
private Queue<InputStream>
Inherited from java.io.FilterInputStream:
in

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected boolean

Returns:

true if the element was added to the InputStreams queue.
addInputStream
(InputStream
the InputStream to add.
newIn
)

Adds another InputStream to the InputStreams queue.

public int

Returns:

the number of bytes available.
available
()

Overrides java.io.FilterInputStream.available.

Returns the number of bytes available in the active underlying InputStream.

public void
close()

Overrides java.io.FilterInputStream.close.

Implements java.io.Closeable.close.

Closes this stream and all underlying InputStreams.

private void
ensureOpen()

Ensures that this InputStream wasn't closed yet.

private boolean

Returns:

true if the currently active InputStream was replaced by a new one.
nextInLine
()

Closes the currently active InputStream and replaces it by the the head of the InputStreams queue.

public int
read()

Overrides java.io.FilterInputStream.read.

Reads one byte from the underlying InputStream.

public int
read(byte[]
the buffer into which the data is read.
b
)

Overrides java.io.FilterInputStream.read.

Forwards the read to read(byte[], int, int).

public int
read(byte[]
the buffer into which the data is read.
b
,
int
the start offset in array b at which the data is written.
off
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.FilterInputStream.read.

Reads bytes from the underlying InputStream.

Inherited from java.io.FilterInputStream:
markmarkSupportedresetskip

Field Detail

closedback to summary
private boolean closed
inputStreamsback to summary
private Queue<InputStream> inputStreams

Constructor Detail

ContinuousInputStreamback to summary
protected ContinuousInputStream(InputStream in)

Method Detail

addInputStreamback to summary
protected boolean addInputStream(InputStream newIn)

Adds another InputStream to the InputStreams queue.

Parameters
newIn:InputStream

the InputStream to add.

Returns:boolean

true if the element was added to the InputStreams queue.

availableback to summary
public int available() throws IOException

Overrides java.io.FilterInputStream.available.

Returns the number of bytes available in the active underlying InputStream.

Returns:int

the number of bytes available.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.available.

if an I/O error occurs.

See Also
FilterInputStream#available()
closeback to summary
public void close() throws IOException

Overrides java.io.FilterInputStream.close.

Implements java.io.Closeable.close.

Closes this stream and all underlying InputStreams.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.close.

if an I/O error occurs.

See Also
FilterInputStream#close()
ensureOpenback to summary
private void ensureOpen() throws IOException

Ensures that this InputStream wasn't closed yet.

Exceptions
IOException:
if this InputStream was closed.
nextInLineback to summary
private boolean nextInLine() throws IOException

Closes the currently active InputStream and replaces it by the the head of the InputStreams queue.

Returns:boolean

true if the currently active InputStream was replaced by a new one.

Exceptions
IOException:
if errors occur while closing the currently active InputStream.
readback to summary
public int read() throws IOException

Overrides java.io.FilterInputStream.read.

Reads one byte from the underlying InputStream. When EOF is reached, then reads from the next InputStream in the queue.

Returns:int

Doc from java.io.FilterInputStream.read.

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.read.

if an I/O error occurs.

See Also
FilterInputStream#read()
readback to summary
public int read(byte[] b) throws IOException

Overrides java.io.FilterInputStream.read.

Forwards the read to read(byte[], int, int).

Parameters
b:byte[]

Doc from java.io.FilterInputStream.read.

the buffer into which the data is read.

Returns:int

Doc from java.io.FilterInputStream.read.

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.read.

if an I/O error occurs.

See Also
FilterInputStream#read(byte[])
readback to summary
public int read(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterInputStream.read.

Reads bytes from the underlying InputStream. When EOF is reached, then reads from the next InputStream in the queue.

Parameters
b:byte[]

Doc from java.io.FilterInputStream.read.

the buffer into which the data is read.

off:int

Doc from java.io.FilterInputStream.read.

the start offset in array b at which the data is written.

len:int

Doc from java.io.FilterInputStream.read.

the maximum number of bytes to read.

Returns:int

Doc from java.io.FilterInputStream.read.

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.read.

if an I/O error occurs.

See Also
FilterInputStream#read(byte[], int, int)