Package gov.usgs.util

Class StreamUtils.UnclosableOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Enclosing class:
    StreamUtils

    public static class StreamUtils.UnclosableOutputStream
    extends java.io.FilterOutputStream
    An OutputStream that ignores calls to close. Used for methods that automatically close a stream, even though it is undesirable for the stream to be closed, such as when using a ZipOutputStream.
    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      UnclosableOutputStream​(java.io.OutputStream out)
      Create a new UnclosableOutputStream object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Flush written content, but does not close stream.
      • Methods inherited from class java.io.FilterOutputStream

        flush, write, write, write
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UnclosableOutputStream

        public UnclosableOutputStream​(java.io.OutputStream out)
        Create a new UnclosableOutputStream object.
        Parameters:
        out - the OutputStream to wrap.
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Flush written content, but does not close stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterOutputStream
        Throws:
        java.io.IOException