Class LimitedInputStream

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

    public class LimitedInputStream
    extends PositionInputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long limit  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void enforceLimit()  
      private int getBytesLeft()  
      int read()  
      int read​(byte[] b, int off, int len)  
      long skip​(long n)  
      • Methods inherited from class java.io.FilterInputStream

        read
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • limit

        private final long limit
    • Constructor Detail

      • LimitedInputStream

        public LimitedInputStream​(java.io.InputStream instream,
                                  long limit)
    • Method Detail

      • enforceLimit

        private void enforceLimit()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class PositionInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class PositionInputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class PositionInputStream
        Throws:
        java.io.IOException
      • getBytesLeft

        private int getBytesLeft()