Package org.cip4.jdflib.util.zip
Class ZipReader
java.lang.Object
org.cip4.jdflib.util.zip.ZipReader
class to read a zip file or stream
-
Constructor Summary
ConstructorsConstructorDescriptionZipReader(InputStream inStream) ZipReader(InputStream inStream, int maxBuffer) -
Method Summary
Modifier and TypeMethodDescriptionvoidbuffer()voidclose()get the next entry - this can be used in non-buffered mode returns null in case of snafuget the vector of zip entriesget an entry by name - note that we need to buffer the entire file for this random access methodstatic StringgetEntryName(ZipEntry ze) retrieves the name and replaces any '\' with '/' and removes any spurious '.' or '..' in the pathget the stream to read this from; note that we must close manuallyget the xmlDoc of the current entry - note not threadsafe!getMatchingEntries(String expr, boolean sortName) get entries by name - note that we need to buffer the entire file for this random access methodgetMatchingEntry(String expr, int iSkip) get an entry by name - note that we need to buffer the entire file for this random access methodintget the next entry - this can be used in non-buffered mode returns null in case of snafugetNextMatchingEntry(String expr) get the next entry by expression - note that we need to buffer the entire file for this random access methodGetter for rootEntry name attribute.get the xmlDoc of the current entry - note not threadsafe!static ZipReadergetZipReader(File jarFile) static ZipReadergetZipReader(File jarFile, boolean search) static ZipReaderget a zip reader that searches itself for a valid zip headerstatic ZipReadergetZipReader(InputStream is, boolean bSearch) get a zip reader that searches itself for a valid zip headergetZipReaders(InputStream is, int max) get a zip reader that searches itself for a valid zip headerbooleanreturn true if all checks are cese sensitive (the default)voidsetCaseSensitive(boolean caseSensitive) set the case sensitivity for matching strings and regexpbooleanget an entry by name - note that we need to buffer the entire file for this random access methodvoidsetMaxBuffer(int maxBuffer) voidsetRootEntry(String rootEntry) Setter for rootEntry attribute.toString()intunpack into a directorybooleanunpack an individual entry into a directory
-
Constructor Details
-
ZipReader
- Parameters:
inStream-maxBuffer-
-
ZipReader
- Parameters:
inStream-maxBuffer-
-
ZipReader
- Parameters:
file- the file to read
-
ZipReader
- Parameters:
file- the file to read
-
ZipReader
- Parameters:
fileName-
-
-
Method Details
-
getMaxBuffer
public int getMaxBuffer() -
setMaxBuffer
public void setMaxBuffer(int maxBuffer) -
getRootEntry
Getter for rootEntry name attribute.- Returns:
- the rootEntry name, null if not set
-
setRootEntry
Setter for rootEntry attribute. use this to allow local searches relative to rootEntry- Parameters:
rootEntry- the rootEntry to set
-
isCaseSensitive
public boolean isCaseSensitive()return true if all checks are cese sensitive (the default)- Returns:
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) set the case sensitivity for matching strings and regexp- Parameters:
caseSensitive-
-
getEntries
get the vector of zip entries- Returns:
-
ensureEntry
get the next entry - this can be used in non-buffered mode returns null in case of snafu- Returns:
-
getNextEntry
get the next entry - this can be used in non-buffered mode returns null in case of snafu- Returns:
-
unPack
unpack into a directory- Parameters:
dir- the destination directory- Returns:
-
unPack
unpack an individual entry into a directory- Parameters:
dir-ze-- Returns:
- true if copied
-
getEntryName
retrieves the name and replaces any '\' with '/' and removes any spurious '.' or '..' in the path- Parameters:
ze-- Returns:
-
getZipReader
get a zip reader that searches itself for a valid zip header- Parameters:
is-
-
getZipReader
get a zip reader that searches itself for a valid zip header- Parameters:
is-
-
getZipReaders
get a zip reader that searches itself for a valid zip header- Parameters:
is-
-
getEntry
get an entry by name - note that we need to buffer the entire file for this random access method- Parameters:
urlString- the file path (case sensitive)- Returns:
-
setEntry
get an entry by name - note that we need to buffer the entire file for this random access method- Parameters:
zeSet- the zip entry to set- Returns:
-
getMatchingEntry
get an entry by name - note that we need to buffer the entire file for this random access method- Parameters:
expr- the regexp of the path (including directories) to match - simplified regexp is acceptediSkip- how many to skip - default= 0- Returns:
-
getMatchingEntries
get entries by name - note that we need to buffer the entire file for this random access method- Parameters:
expr- the regexp of the path (including directories) to match - simplified regexp is accepted- Returns:
-
getNextMatchingEntry
get the next entry by expression - note that we need to buffer the entire file for this random access method- Parameters:
expr- the regexp to match - simplified regexp is accepted- Returns:
-
getInputStream
get the stream to read this from; note that we must close manually- Returns:
-
getXMLDoc
get the xmlDoc of the current entry - note not threadsafe!- Returns:
-
getJDFDoc
get the xmlDoc of the current entry - note not threadsafe!- Returns:
-
buffer
public void buffer() -
close
public void close() -
toString
-
getZipReader
- Parameters:
jarFile-- Returns:
-
getZipReader
- Parameters:
jarFile-- Returns:
-