Class ProxyOutputStream
java.lang.Object
java.io.OutputStream
net.logstash.logback.util.ProxyOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
A Proxy stream which acts as expected, that is it passes the method calls on
to the proxied stream and doesn't change which methods are being called (unlike
JDK
FilterOutputStream).
Note: This class is for internal use only and subject to backward incompatible change at any time.
- Author:
- brenuart
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProxyOutputStream(OutputStream delegate) Constructs a new ProxyOutputStream. -
Method Summary
Modifier and TypeMethodDescriptionprotected OutputStreamGet the underlying OutputStream and assert it is connected.voidclose()Invokes the delegate'sclose()method.voidflush()Invokes the delegate'sflush()method.protected voidHandle any IOExceptions thrown.voidwrite(byte[] b) Invokes the delegate'swrite(byte[])method.voidwrite(byte[] b, int off, int len) Invokes the delegate'swrite(byte[])method.voidwrite(int b) Invokes the delegate'swrite(int)method.Methods inherited from class OutputStream
nullOutputStream
-
Field Details
-
delegate
-
-
Constructor Details
-
ProxyOutputStream
Constructs a new ProxyOutputStream.- Parameters:
delegate- the OutputStream to delegate to
-
-
Method Details
-
write
Invokes the delegate'swrite(int)method.- Specified by:
writein classOutputStream- Parameters:
b- the byte to write- Throws:
IOException- if an I/O error occurs
-
write
Invokes the delegate'swrite(byte[])method.- Overrides:
writein classOutputStream- Parameters:
b- the bytes to write- Throws:
IOException- if an I/O error occurs
-
write
Invokes the delegate'swrite(byte[])method.- Overrides:
writein classOutputStream- Parameters:
b- the bytes to writeoff- The start offsetlen- The number of bytes to write- Throws:
IOException- if an I/O error occurs
-
flush
Invokes the delegate'sflush()method.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- if an I/O error occurs
-
close
Invokes the delegate'sclose()method.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException- if an I/O error occurs
-
handleIOException
Handle any IOExceptions thrown.This method provides a point to implement custom exception handling. The default behavior is to re-throw the exception.
- Parameters:
e- The IOException thrown- Throws:
IOException- if an I/O error occurs
-
assertStreamConnected
Get the underlying OutputStream and assert it is connected.- Returns:
- the underlying OutputStream
- Throws:
IOException- thrown when the stream is not connected
-