Class VirtualJarFileInputStream
java.lang.Object
java.io.InputStream
org.jboss.vfs.VirtualJarFileInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
An input stream that can be used to wrap an VirtualJarInputStream (so any VFS dir)
and produce a byte stream following the Zip standard.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate classprivate static enumBasic state machine that will allow the process to transition between the different process states. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final VirtualJarFileInputStream.ByteBufferprivate longprivate final CRC32private intprivate VirtualJarFileInputStream.Stateprivate static final intprivate final List<VirtualJarFileInputStream.ProcessedEntry> private longprivate final VirtualJarInputStream -
Constructor Summary
ConstructorsConstructorDescriptionVirtualJarFileInputStream(VirtualJarInputStream virtualJarInputStream) Create with the minimum put lengthVirtualJarFileInputStream(VirtualJarInputStream virtualJarInputStream, int bufferLength) Create with the a specified put size -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbuffer(byte b) Buffer a single byteprivate voidbuffer(byte[] bytes) Buffer a byte arrayprivate voidWrite the central file header records.private voidbufferInt(long i) Buffer a 32-bit integer in little-endianprivate booleanBuffer the content of the local file header for a single entry.private booleanBuffer the central file header record for a single entry.private voidbufferShort(int i) Buffer a 16-bit short in little-endianvoidclose()private voidClose the current entry, and calculate the crc value.intread()Methods inherited from class InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
MINIMUM_BUFFER_LENGTH
private static final int MINIMUM_BUFFER_LENGTH- See Also:
-
virtualJarInputStream
-
currentState
-
processedEntries
-
currentEntry
-
buffer
-
crc
-
currentCentralEntryIdx
private int currentCentralEntryIdx -
centralOffset
private long centralOffset -
totalRead
private long totalRead
-
-
Constructor Details
-
VirtualJarFileInputStream
Create with the minimum put length- Parameters:
virtualJarInputStream- The virtual jar input stream to base the stream off of
-
VirtualJarFileInputStream
Create with the a specified put size- Parameters:
virtualJarInputStream- The virtual jar input stream to base the stream off ofbufferLength- The length of put to use
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
closeCurrent
Close the current entry, and calculate the crc value.- Throws:
IOException- if any problems occur
-
bufferLocalFileHeader
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
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
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
-