Package org.jboss.vfs
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 class
private class
private static enum
Basic state machine that will allow the process to transition between the different process states. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final VirtualJarFileInputStream.ByteBuffer
private long
private final CRC32
private int
private VirtualJarFileInputStream.State
private static final int
private final List
<VirtualJarFileInputStream.ProcessedEntry> private long
private 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 void
buffer
(byte b) Buffer a single byteprivate void
buffer
(byte[] bytes) Buffer a byte arrayprivate void
Write the central file header records.private void
bufferInt
(long i) Buffer a 32-bit integer in little-endianprivate boolean
Buffer the content of the local file header for a single entry.private boolean
Buffer the central file header record for a single entry.private void
bufferShort
(int i) Buffer a 16-bit short in little-endianvoid
close()
private void
Close the current entry, and calculate the crc value.int
read()
Methods inherited from class java.io.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:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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
-