Package org.jboss.vfs

Class VirtualJarFileInputStream

java.lang.Object
java.io.InputStream
org.jboss.vfs.VirtualJarFileInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class VirtualJarFileInputStream extends 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.
  • Field Details

  • Constructor Details

    • 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 Details

    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException
    • closeCurrent

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

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

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

      private void bufferCentralDirectoryEnd() throws IOException
      Write the central file header records. This is repeated until all entries have been added to the central file header.
      Throws:
      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