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 voidflush()Flushes the output stream, forcing any buffered output bytes to be written out.voidwrite(byte[] b, int off, int len)Writes bytes from the specified byte array starting at offset off to the output stream.voidwrite(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 IOExceptionWrites a single byte of data to the output stream.- Specified by:
writein 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 IOExceptionWrites bytes from the specified byte array starting at offset off to the output stream.- Overrides:
writein 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 IOExceptionFlushes the output stream, forcing any buffered output bytes to be written out. Automatically called bywrite(int)andwrite(byte[], int, int).- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- if an I/O error occurs
-
-