public class FilteredOutputStream extends FilterOutputStream
See the protected methods for ways in which a subclass can easily decorate a stream with custom pre-, post- or error processing functionality.
out| Constructor and Description |
|---|
FilteredOutputStream(OutputStream out)
Constructs a new ProxyOutputStream.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterWrite(int n)
Invoked by the write methods after the proxied call has returned
successfully.
|
protected void |
beforeWrite(int n)
Invoked by the write methods before the call is proxied.
|
void |
close()
Invokes the delegate's
close() method. |
void |
flush()
Invokes the delegate's
flush() method. |
protected void |
onThrowable(Throwable t)
Handle any IOExceptions thrown.
|
void |
write(byte[] bts)
Invokes the delegate's
write(byte[]) method. |
void |
write(byte[] bts,
int st,
int end)
Invokes the delegate's
write(byte[]) method. |
void |
write(int idx)
Invokes the delegate's
write(int) method. |
public FilteredOutputStream(OutputStream out)
out - the OutputStream to delegate toprotected void afterWrite(int n)
throws IOException
write(int) method, buffer length for write(byte[]),
etc.) is given as an argument.
Subclasses can override this method to add common post-processing functionality without having to override all the write methods. The default implementation does nothing.
n - number of bytes writtenIOException - if the post-processing failsprotected void beforeWrite(int n)
throws IOException
write(int) method, buffer
length for write(byte[]), etc.) is given as an argument.
Subclasses can override this method to add common pre-processing functionality without having to override all the write methods. The default implementation does nothing.
n - number of bytes to be writtenIOException - if the pre-processing failspublic void close()
throws IOException
close() method.close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOException - if an I/O error occurs.public void flush()
throws IOException
flush() method.flush in interface Flushableflush in class FilterOutputStreamIOException - if an I/O error occurs.protected void onThrowable(Throwable t) throws IOException
This method provides a point to implement custom exception handling. The default behavior is to re-throw the exception.
t - The Throwable thrownIOException - if an I/O error occurs.public void write(byte[] bts)
throws IOException
write(byte[]) method.write in class FilterOutputStreambts - the bytes to writeIOException - if an I/O error occurs.public void write(byte[] bts,
int st,
int end)
throws IOException
write(byte[]) method.write in class FilterOutputStreambts - the bytes to writest - The start offsetend - The number of bytes to writeIOException - if an I/O error occurs.public void write(int idx)
throws IOException
write(int) method.write in class FilterOutputStreamidx - the byte to writeIOException - if an I/O error occurs.Copyright © 2014–2024 jsonwebtoken.io. All rights reserved.