? ProxyOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.io.output.ProxyOutputStream
????????:
Closeable, Flushable, AutoCloseable
??????:
CloseShieldOutputStream, CountingOutputStream, TaggedOutputStream, TeeOutputStream

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. It is an alternative base class to FilterOutputStream to increase reusability.

See the protected methods for ways in which a subclass can easily decorate a stream with custom pre-, post- or error processing functionality.

  • ???????

    • ProxyOutputStream

      Constructs a new ProxyOutputStream.
      ??:
      proxy - the OutputStream to delegate to
  • ??????

    • write

      public void write(int idx) throws IOException
      Invokes the delegate's write(int) method.
      ??:
      write ??? FilterOutputStream
      ??:
      idx - the byte to write
      ??:
      IOException - if an I/O error occurs.
    • write

      public void write(byte[] bts) throws IOException
      Invokes the delegate's write(byte[]) method.
      ??:
      write ??? FilterOutputStream
      ??:
      bts - the bytes to write
      ??:
      IOException - if an I/O error occurs.
    • write

      public void write(byte[] bts, int st, int end) throws IOException
      Invokes the delegate's write(byte[]) method.
      ??:
      write ??? FilterOutputStream
      ??:
      bts - the bytes to write
      st - The start offset
      end - The number of bytes to write
      ??:
      IOException - if an I/O error occurs.
    • flush

      public void flush() throws IOException
      Invokes the delegate's flush() method.
      ???:
      flush ???? Flushable
      ??:
      flush ??? FilterOutputStream
      ??:
      IOException - if an I/O error occurs.
    • close

      public void close() throws IOException
      Invokes the delegate's close() method.
      ???:
      close ???? AutoCloseable
      ???:
      close ???? Closeable
      ??:
      close ??? FilterOutputStream
      ??:
      IOException - if an I/O error occurs.
    • beforeWrite

      protected void beforeWrite(int n) throws IOException
      Invoked by the write methods before the call is proxied. The number of bytes to be written (1 for the 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 written
      ??:
      IOException - if the pre-processing fails
      ???????:
      2.0
    • afterWrite

      protected void afterWrite(int n) throws IOException
      Invoked by the write methods after the proxied call has returned successfully. The number of bytes written (1 for the 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 written
      ??:
      IOException - if the post-processing fails
      ???????:
      2.0
    • handleIOException

      protected void handleIOException(IOException e) throws IOException
      Handle any IOExceptions thrown.

      This method provides a point to implement custom exception handling. The default behavior is to re-throw the exception.

      ??:
      e - The IOException thrown
      ??:
      IOException - if an I/O error occurs.
      ???????:
      2.0