Package org.jboss.vfs

Class VirtualJarFileInputStream

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

    public class VirtualJarFileInputStream
    extends java.io.InputStream
    An input stream that can be used to wrap an VirtualJarInputStream (so any VFS dir) and produce a byte stream following the Zip standard.
    • Constructor Detail

      • VirtualJarFileInputStream

        public VirtualJarFileInputStream​(VirtualJarInputStream virtualJarInputStream)
        Create with the minimum put length
        Parameters:
        virtualJarInputStream - The virtual jar input stream to base the stream off of
      • VirtualJarFileInputStream

        public VirtualJarFileInputStream​(VirtualJarInputStream virtualJarInputStream,
                                         int bufferLength)
        Create with the a specified put size
        Parameters:
        virtualJarInputStream - The virtual jar input stream to base the stream off of
        bufferLength - The length of put to use
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read 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
      • closeCurrent

        private void closeCurrent()
                           throws java.io.IOException
        Close the current entry, and calculate the crc value.
        Throws:
        java.io.IOException - if any problems occur
      • bufferLocalFileHeader

        private boolean bufferLocalFileHeader()
                                       throws java.io.IOException
        Buffer the content of the local file header for a single entry.
        Returns:
        true if the next local file header was buffered
        Throws:
        java.io.IOException - if any problems occur
      • bufferNextCentralFileHeader

        private boolean bufferNextCentralFileHeader()
                                             throws java.io.IOException
        Buffer the central file header record for a single entry.
        Returns:
        true if the next central file header was buffered
        Throws:
        java.io.IOException - if any problems occur
      • bufferCentralDirectoryEnd

        private void bufferCentralDirectoryEnd()
                                        throws java.io.IOException
        Write the central file header records. This is repeated until all entries have been added to the central file header.
        Throws:
        java.io.IOException - if any problem occur
      • bufferInt

        private void bufferInt​(long i)
        Buffer a 32-bit integer in little-endian
        Parameters:
        i - A long representation of a 32 bit int
      • bufferShort

        private void bufferShort​(int i)
        Buffer a 16-bit short in little-endian
        Parameters:
        i - An int representation of a 16 bit short
      • buffer

        private void buffer​(byte b)
        Buffer a single byte
        Parameters:
        b - The byte
      • buffer

        private void buffer​(byte[] bytes)
        Buffer a byte array
        Parameters:
        bytes - The bytes