Package com.ngrok.net
Class ConnectionInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.ngrok.net.ConnectionInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ConnectionInputStream extends InputStream
An input stream for reading data fromConnection
.
-
-
Constructor Summary
Constructors Constructor Description ConnectionInputStream(Connection connection, int bufferSize)
Creates a new input stream for the given connection with the specified buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
read()
Reads a single byte of data from the input stream.int
read(byte[] b, int off, int len)
Reads up to len bytes of data from the input stream into an array of bytes.-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
ConnectionInputStream
public ConnectionInputStream(Connection connection, int bufferSize)
Creates a new input stream for the given connection with the specified buffer size.- Parameters:
connection
- the connection to read frombufferSize
- the size of the buffer to use to read data from the connection
-
-
Method Detail
-
read
public int read() throws IOException
Reads a single byte of data from the input stream.- Specified by:
read
in classInputStream
- Returns:
- the byte of data, or -1 if the end of the stream has been reached
- Throws:
IOException
- if an I/O error occurs
-
read
public int read(byte[] b, int off, int len) throws IOException
Reads up to len bytes of data from the input stream into an array of bytes.- Overrides:
read
in classInputStream
- Parameters:
b
- the array of bytes to read the data intooff
- the offset within the buffer to start reading the data fromlen
- the maximum number of bytes to read- Returns:
- the total number of bytes read into the buffer, or -1 if the end of the stream has been reached
- Throws:
IOException
- if an I/O error occurs
-
-