Class MonitoringInputStream

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

    public class MonitoringInputStream
    extends java.io.InputStream
    • Field Detail

      • content

        private final java.io.InputStream content
      • totalSize

        private final long totalSize
      • fileName

        private final java.lang.String fileName
      • byteCount

        private long byteCount
    • Constructor Detail

      • MonitoringInputStream

        public MonitoringInputStream​(java.io.InputStream content,
                                     ProgressMonitor downloadMonitor,
                                     java.nio.file.Path target,
                                     RawResponse rawResponse)
      • MonitoringInputStream

        public MonitoringInputStream​(java.io.InputStream content,
                                     ProgressMonitor downloadMonitor,
                                     java.lang.String fileName,
                                     RawResponse rawResponse)
    • Method Detail

      • wrap

        private java.io.InputStream wrap​(java.io.InputStream is,
                                         RawResponse rawResponse)
      • getBodySize

        private java.lang.Long getBodySize​(RawResponse r)
      • read

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

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

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

        private void monitor​(int bytesRead)
      • 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.InputStream
        Throws:
        java.io.IOException
      • skip

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

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException