Class WeakZipFileFactory.WeakZipFile.WeakZipInputStream

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

    class WeakZipFileFactory.WeakZipFile.WeakZipInputStream
    extends java.io.InputStream
    This is an InputStream wrapper that will properly reopen the underlying zip file if it is weakly closed and create the underlying input stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      WeakZipInputStream​(java.lang.String entryName, java.io.InputStream is)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      private void ensureInputStreamIsValid()
      This internal method ensures that the zip file is open and that the underlying input stream is valid.
      void mark​(int i)  
      boolean markSupported()  
      int read()  
      int read​(byte[] bytes)  
      int read​(byte[] bytes, int i, int i1)  
      void reset()  
      long skip​(long l)  
      • 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

      • m_entryName

        private final java.lang.String m_entryName
      • m_is

        private java.io.InputStream m_is
      • m_currentPos

        private int m_currentPos
      • m_zipFileSnapshot

        private java.util.zip.ZipFile m_zipFileSnapshot
    • Constructor Detail

      • WeakZipInputStream

        WeakZipInputStream​(java.lang.String entryName,
                           java.io.InputStream is)
    • Method Detail

      • ensureInputStreamIsValid

        private void ensureInputStreamIsValid()
                                       throws java.io.IOException
        This internal method ensures that the zip file is open and that the underlying input stream is valid. Upon successful completion, the underlying input stream will be valid and the local mutex will be held.
        Throws:
        java.io.IOException - if the was an error handling the input stream.
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • 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
      • mark

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

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • 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[] bytes)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] bytes,
                        int i,
                        int i1)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • reset

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

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