Class ConsumingInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class ConsumingInputStream
    extends java.io.FilterInputStream
    This class in meant to wrap an InputStream so that all bytes in the steam are read and discarded on InputStream.close(). This ensures that the underlying connection has the option to be reused.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean closed  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsumingInputStream​(java.io.InputStream inputStream)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      • Methods inherited from class java.io.FilterInputStream

        available, mark, markSupported, read, read, read, reset, skip
      • Methods inherited from class java.lang.Object

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

      • closed

        private boolean closed
    • Constructor Detail

      • ConsumingInputStream

        ConsumingInputStream​(java.io.InputStream inputStream)
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterInputStream
        Throws:
        java.io.IOException