Class NetHttpResponse.SizeValidatingInputStream

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

    private final class NetHttpResponse.SizeValidatingInputStream
    extends java.io.FilterInputStream
    A wrapper arround the base InputStream that validates EOF returned by the read calls.
    Since:
    1.20
    • Field Summary

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

        in
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read()  
      int read​(byte[] b, int off, int len)
      java.io.InputStream#read(byte[], int, int) swallows IOException thrown from read() so we have to override it.
      private void throwIfFalseEOF()  
      • Methods inherited from class java.io.FilterInputStream

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

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

      • bytesRead

        private long bytesRead
    • Constructor Detail

      • SizeValidatingInputStream

        public SizeValidatingInputStream​(java.io.InputStream in)
    • Method Detail

      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        java.io.InputStream#read(byte[], int, int) swallows IOException thrown from read() so we have to override it.
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
        See Also:
        "http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/io/InputStream.java#185"
      • read

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

        private void throwIfFalseEOF()
                              throws java.io.IOException
        Throws:
        java.io.IOException