Class LimitedInputStream

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

    public final class LimitedInputStream
    extends java.io.InputStream
    This class provide functionality to limit bytes read from InputStream. You need to wrap chained compression stream with this stream to prevent overreading inner stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      LimitedInputStream​(java.io.InputStream in, long limit)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read()  
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • LimitedInputStream

        public LimitedInputStream​(java.io.InputStream in,
                                  long limit)
        Constructor.
        Parameters:
        in - InputStream that should be limited.
        limit - bytes to limit.
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException