Class DirectoryInputStream

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

    public class DirectoryInputStream
    extends java.io.InputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static int BUFFER_SIZE  
      (package private) java.io.InputStream current  
      (package private) static int DATA  
      (package private) java.io.ByteArrayOutputStream directory  
      (package private) static int DIRECTORY  
      (package private) java.io.File element  
      (package private) int entries  
      (package private) static java.io.InputStream eof  
      (package private) static int EOF  
      (package private) FileIterator fi  
      (package private) static int HEADER  
      (package private) java.io.File root  
      (package private) static int START  
      (package private) int state  
      (package private) long where  
    • Constructor Summary

      Constructors 
      Constructor Description
      DirectoryInputStream​(java.io.File dir)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.zip.CRC32 getCRC​(java.io.File file)  
      (package private) java.io.InputStream getDirectory()
      end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes number of the disk with the start of the central directory 2 bytes total number of entries in the central directory on this disk 2 bytes total number of entries in the central directory 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes .ZIP file comment length 2 bytes .ZIP file comment (variable size)
      private java.io.InputStream getHeader​(java.io.File root, java.io.File file)
      Local file header:
      private java.lang.String getPath​(java.io.File root, java.io.File file)  
      (package private) void next()  
      private void nextHeader()  
      int read()  
      private void writeInt​(java.io.OutputStream out, int v)  
      private void writeShort​(java.io.OutputStream out, int v)  
      • Methods inherited from class java.io.InputStream

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

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

      • DirectoryInputStream

        public DirectoryInputStream​(java.io.File dir)
    • Method Detail

      • read

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

        void next()
           throws java.io.IOException
        Throws:
        java.io.IOException
      • nextHeader

        private void nextHeader()
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • getDirectory

        java.io.InputStream getDirectory()
                                  throws java.io.IOException
          end of central dir signature 4 bytes (0x06054b50) number of this
         disk 2 bytes number of the disk with the start of the central directory 2
         bytes total number of entries in the central directory on this disk 2
         bytes total number of entries in the central directory 2 bytes size of
         the central directory 4 bytes offset of start of central directory with
         respect to the starting disk number 4 bytes .ZIP file comment length 2
         bytes .ZIP file comment (variable size)
         
        Throws:
        java.io.IOException
      • writeShort

        private void writeShort​(java.io.OutputStream out,
                                int v)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeInt

        private void writeInt​(java.io.OutputStream out,
                              int v)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getHeader

        private java.io.InputStream getHeader​(java.io.File root,
                                              java.io.File file)
                                       throws java.io.IOException
        Local file header:
          local file header signature 4 bytes (0x04034b50)
         version needed to extract 2 bytes general purpose bit flag 2 bytes
         compression method 2 bytes last mod file time 2 bytes last mod file date
         2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes
         file name length 2 bytes extra field length 2 bytes file name (variable
         size) extra field (variable size) central file header signature 4 bytes
         (0x02014b50) version made by 2 bytes version needed to extract 2 bytes
         general purpose bit flag 2 bytes compression method 2 bytes last mod file
         time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4
         bytes uncompressed size 4 bytes file name length 2 bytes extra field
         length 2 bytes file comment length 2 bytes disk number start 2 bytes
         internal file attributes 2 bytes external file attributes 4 bytes
         relative offset of local header 4 bytes file name (variable size) extra
         field (variable size) file comment (variable size)
         
        Throws:
        java.io.IOException
      • getPath

        private java.lang.String getPath​(java.io.File root,
                                         java.io.File file)
      • getCRC

        private java.util.zip.CRC32 getCRC​(java.io.File file)
                                    throws java.io.IOException
        Throws:
        java.io.IOException