Package com.ngrok.net
Class ConnectionOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.ngrok.net.ConnectionOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class ConnectionOutputStream extends OutputStream
An output stream for writing data toConnection
.
-
-
Constructor Summary
Constructors Constructor Description ConnectionOutputStream(Connection connection, int bufferSize)
Creates a new output stream for the given connection, backed by a direct buffer with the specified buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flush()
Flushes the output stream, forcing any buffered output bytes to be written out.void
write(byte[] b, int off, int len)
Writes bytes from the specified byte array starting at offset off to the output stream.void
write(int b)
Writes a single byte of data to the output stream.-
Methods inherited from class java.io.OutputStream
close, nullOutputStream, write
-
-
-
-
Constructor Detail
-
ConnectionOutputStream
public ConnectionOutputStream(Connection connection, int bufferSize)
Creates a new output stream for the given connection, backed by a direct buffer with the specified buffer size.- Parameters:
connection
- the connection to write tobufferSize
- the size of the buffer to use to write data to the connection
-
-
Method Detail
-
write
public void write(int b) throws IOException
Writes a single byte of data to the output stream.- Specified by:
write
in classOutputStream
- Parameters:
b
- the byte to write- Throws:
IOException
- if an I/O error occurs
-
write
public void write(byte[] b, int off, int len) throws IOException
Writes bytes from the specified byte array starting at offset off to the output stream.- Overrides:
write
in classOutputStream
- Parameters:
b
- the array of bytes to writeoff
- the offset within the buffer to start writing fromlen
- the number of bytes to write- Throws:
IOException
- if an I/O error occurs
-
flush
public void flush() throws IOException
Flushes the output stream, forcing any buffered output bytes to be written out. Automatically called bywrite(int)
andwrite(byte[], int, int)
.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- if an I/O error occurs
-
-