public class ResilientSocketOutputStream extends OutputStream
OutputStream
.
Automatically tries to reconnect to the server if it encounters errors during writing
data via a TCP connection.Modifier and Type | Field and Description |
---|---|
protected OutputStream |
os |
Constructor and Description |
---|
ResilientSocketOutputStream(String host,
int port,
int connectionTimeoutMs,
int sendBufferSize,
SocketFactory socketFactory)
Creates a new stream based on the socket configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
ch.qos.logback.core.Context |
getContext() |
void |
setContext(ch.qos.logback.core.Context context) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
write
protected OutputStream os
public ResilientSocketOutputStream(String host, int port, int connectionTimeoutMs, int sendBufferSize, SocketFactory socketFactory)
host
- The host or an IP address of the server.port
- The port on the server which accepts TCP connections.connectionTimeoutMs
- The timeout for establishing a new TCP connection.sendBufferSize
- The size of the send buffer of the socket stream in bytes.socketFactory
- The factory for customizing the client socket.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void write(byte[] b, int off, int len)
write
in class OutputStream
public void write(int b)
write
in class OutputStream
public void flush()
flush
in interface Flushable
flush
in class OutputStream
public ch.qos.logback.core.Context getContext()
public void setContext(ch.qos.logback.core.Context context)
Copyright © 2011. All rights reserved.