Class LimitedInputStream

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

    public class LimitedInputStream
    extends PositionInputStream
    • 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()