Package org.jboss.vfs
Class VirtualJarInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.util.zip.InflaterInputStream
-
- java.util.zip.ZipInputStream
-
- java.util.jar.JarInputStream
-
- org.jboss.vfs.VirtualJarInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class VirtualJarInputStream extends java.util.jar.JarInputStreamVirtual JarInputStream used for representing any VFS directory as a JarInputStream.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVirtualJarInputStream.VirtualJarEntryVirtual JarEntry used for representing a child VirtualFile as a JarEntry.
-
Field Summary
Fields Modifier and Type Field Description static intCENATTstatic intCENATXstatic intCENCOMstatic intCENCRCstatic intCENDSKstatic intCENEXTstatic intCENFLGstatic intCENHDRstatic intCENHOWstatic intCENLENstatic intCENNAMstatic intCENOFFstatic longCENSIGstatic intCENSIZstatic intCENTIMstatic intCENVEMstatic intCENVERprivate booleanclosedprivate java.io.InputStreamcurrentEntryStreamprivate VirtualFilecurrentVirtualFilestatic intENDCOMstatic intENDHDRstatic intENDOFFstatic longENDSIGstatic intENDSIZstatic intENDSUBstatic intENDTOTprivate java.util.Deque<java.util.Iterator<VirtualFile>>entryItrstatic intEXTCRCstatic intEXTHDRstatic intEXTLENstatic longEXTSIGstatic intEXTSIZstatic intLOCCRCstatic intLOCEXTstatic intLOCFLGstatic intLOCHDRstatic intLOCHOWstatic intLOCLENstatic intLOCNAMstatic longLOCSIGstatic intLOCSIZstatic intLOCTIMstatic intLOCVERprivate java.util.jar.Manifestmanifestprivate static VirtualFileFilterMANIFEST_FILTERprivate static java.lang.StringMANIFEST_NAMEprivate static java.lang.StringMETA_INF_DIRprivate VirtualFileroot
-
Constructor Summary
Constructors Constructor Description VirtualJarInputStream(VirtualFile root)Construct aVirtualJarInputStreamfrom aVirtualFileroot
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()*private intcheckForEoSAndReturn(int result)Check to see if the result is the EOF and if so exchange the current entry stream with the empty stream.voidclose()*voidcloseEntry()*private voidensureOpen()*private java.lang.StringfixDirectoryName(java.lang.String name)Make sure directory names end with a trailing slashprivate java.lang.StringgetEntryName(VirtualFile entry)Get the entry name from a VirtualFile.java.util.jar.ManifestgetManifest()*java.util.zip.ZipEntrygetNextEntry()*java.util.jar.JarEntrygetNextJarEntry()*private voidopenCurrent(VirtualFile current)Open the current virtual file as the current JarEntry stream.intread()*intread(byte[] b)*intread(byte[] b, int off, int len)*longskip(long n)*
-
-
-
Field Detail
-
MANIFEST_NAME
private static final java.lang.String MANIFEST_NAME
- See Also:
- Constant Field Values
-
META_INF_DIR
private static final java.lang.String META_INF_DIR
- See Also:
- Constant Field Values
-
MANIFEST_FILTER
private static final VirtualFileFilter MANIFEST_FILTER
-
entryItr
private final java.util.Deque<java.util.Iterator<VirtualFile>> entryItr
-
root
private final VirtualFile root
-
manifest
private final java.util.jar.Manifest manifest
-
currentVirtualFile
private VirtualFile currentVirtualFile
-
currentEntryStream
private java.io.InputStream currentEntryStream
-
closed
private boolean closed
-
LOCSIG
public static final long LOCSIG
- See Also:
- Constant Field Values
-
EXTSIG
public static final long EXTSIG
- See Also:
- Constant Field Values
-
CENSIG
public static final long CENSIG
- See Also:
- Constant Field Values
-
ENDSIG
public static final long ENDSIG
- See Also:
- Constant Field Values
-
LOCHDR
public static final int LOCHDR
- See Also:
- Constant Field Values
-
EXTHDR
public static final int EXTHDR
- See Also:
- Constant Field Values
-
CENHDR
public static final int CENHDR
- See Also:
- Constant Field Values
-
ENDHDR
public static final int ENDHDR
- See Also:
- Constant Field Values
-
LOCVER
public static final int LOCVER
- See Also:
- Constant Field Values
-
LOCFLG
public static final int LOCFLG
- See Also:
- Constant Field Values
-
LOCHOW
public static final int LOCHOW
- See Also:
- Constant Field Values
-
LOCTIM
public static final int LOCTIM
- See Also:
- Constant Field Values
-
LOCCRC
public static final int LOCCRC
- See Also:
- Constant Field Values
-
LOCSIZ
public static final int LOCSIZ
- See Also:
- Constant Field Values
-
LOCLEN
public static final int LOCLEN
- See Also:
- Constant Field Values
-
LOCNAM
public static final int LOCNAM
- See Also:
- Constant Field Values
-
LOCEXT
public static final int LOCEXT
- See Also:
- Constant Field Values
-
EXTCRC
public static final int EXTCRC
- See Also:
- Constant Field Values
-
EXTSIZ
public static final int EXTSIZ
- See Also:
- Constant Field Values
-
EXTLEN
public static final int EXTLEN
- See Also:
- Constant Field Values
-
CENVEM
public static final int CENVEM
- See Also:
- Constant Field Values
-
CENVER
public static final int CENVER
- See Also:
- Constant Field Values
-
CENFLG
public static final int CENFLG
- See Also:
- Constant Field Values
-
CENHOW
public static final int CENHOW
- See Also:
- Constant Field Values
-
CENTIM
public static final int CENTIM
- See Also:
- Constant Field Values
-
CENCRC
public static final int CENCRC
- See Also:
- Constant Field Values
-
CENSIZ
public static final int CENSIZ
- See Also:
- Constant Field Values
-
CENLEN
public static final int CENLEN
- See Also:
- Constant Field Values
-
CENNAM
public static final int CENNAM
- See Also:
- Constant Field Values
-
CENEXT
public static final int CENEXT
- See Also:
- Constant Field Values
-
CENCOM
public static final int CENCOM
- See Also:
- Constant Field Values
-
CENDSK
public static final int CENDSK
- See Also:
- Constant Field Values
-
CENATT
public static final int CENATT
- See Also:
- Constant Field Values
-
CENATX
public static final int CENATX
- See Also:
- Constant Field Values
-
CENOFF
public static final int CENOFF
- See Also:
- Constant Field Values
-
ENDSUB
public static final int ENDSUB
- See Also:
- Constant Field Values
-
ENDTOT
public static final int ENDTOT
- See Also:
- Constant Field Values
-
ENDSIZ
public static final int ENDSIZ
- See Also:
- Constant Field Values
-
ENDOFF
public static final int ENDOFF
- See Also:
- Constant Field Values
-
ENDCOM
public static final int ENDCOM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VirtualJarInputStream
public VirtualJarInputStream(VirtualFile root) throws java.io.IOException
Construct aVirtualJarInputStreamfrom aVirtualFileroot- Parameters:
root- VirtualFile directory to use as the base of the virtual Jar.- Throws:
java.io.IOException
-
-
Method Detail
-
getNextEntry
public java.util.zip.ZipEntry getNextEntry() throws java.io.IOException*- Overrides:
getNextEntryin classjava.util.jar.JarInputStream- Throws:
java.io.IOException
-
getNextJarEntry
public java.util.jar.JarEntry getNextJarEntry() throws java.io.IOException*- Overrides:
getNextJarEntryin classjava.util.jar.JarInputStream- Throws:
java.io.IOException
-
getManifest
public java.util.jar.Manifest getManifest()
*- Overrides:
getManifestin classjava.util.jar.JarInputStream
-
read
public int read() throws java.io.IOException*- Overrides:
readin classjava.util.zip.InflaterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException*- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException*- Overrides:
readin classjava.util.jar.JarInputStream- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException*- Overrides:
availablein classjava.util.zip.ZipInputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException*- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.util.zip.ZipInputStream- Throws:
java.io.IOException
-
closeEntry
public void closeEntry() throws java.io.IOException*- Overrides:
closeEntryin classjava.util.zip.ZipInputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException*- Overrides:
skipin classjava.util.zip.ZipInputStream- Throws:
java.io.IOException
-
ensureOpen
private void ensureOpen() throws java.io.IOException*- Throws:
java.io.IOException
-
checkForEoSAndReturn
private int checkForEoSAndReturn(int result) throws java.io.IOExceptionCheck to see if the result is the EOF and if so exchange the current entry stream with the empty stream.- Parameters:
result-- Returns:
- int result
- Throws:
java.io.IOException
-
openCurrent
private void openCurrent(VirtualFile current) throws java.io.IOException
Open the current virtual file as the current JarEntry stream.- Parameters:
current-- Throws:
java.io.IOException
-
getEntryName
private java.lang.String getEntryName(VirtualFile entry)
Get the entry name from a VirtualFile.- Parameters:
entry-- Returns:
-
fixDirectoryName
private java.lang.String fixDirectoryName(java.lang.String name)
Make sure directory names end with a trailing slash- Parameters:
name-- Returns:
-
-