org.cip4.jdflib.util.zip
Class ZipReader

java.lang.Object
  extended by org.cip4.jdflib.util.zip.ZipReader

public class ZipReader
extends Object

class to read a zip file or stream

Author:
rainer prosi

Constructor Summary
ZipReader(File file)
           
ZipReader(InputStream inStream)
           
ZipReader(String fileName)
           
 
Method Summary
 void buffer()
           
 Vector<ZipEntry> getEntries()
          get the vector of zip entries
 ZipEntry getEntry(String urlString)
          get an entry by name - note that we need to buffer the entire file for this random access method
 InputStream getInputStream()
          get the stream to read this from; note that we must close manually
 JDFDoc getJDFDoc()
          get the xmlDoc of the current entry - note not threadsafe!
 ZipEntry getMatchingEntry(String expr, int iSkip)
          get an entry by name - note that we need to buffer the entire file for this random access method
 ZipEntry getNextEntry()
          get the next entry - this can be used in non-buffered mode returns null in case of snafu
 String getRootEntry()
          Getter for rootEntry name attribute.
 XMLDoc getXMLDoc()
          get the xmlDoc of the current entry - note not threadsafe!
 boolean isCaseSensitive()
          return true if all checks are cese sensitive (the default)
 void setCaseSensitive(boolean caseSensitive)
          set the case sensitivity for matching strings and regexp
 void setRootEntry(String rootEntry)
          Setter for rootEntry attribute. use this to allow local searches relative to rootEntry
 String toString()
           
 int unPack(File dir)
          unpack into a directory
 boolean unPack(File dir, ZipEntry ze)
          unpack an individual entry into a directory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZipReader

public ZipReader(InputStream inStream)
Parameters:
inStream -

ZipReader

public ZipReader(File file)
Parameters:
file - the file to read

ZipReader

public ZipReader(String fileName)
Parameters:
fileName -
Method Detail

getRootEntry

public String getRootEntry()
Getter for rootEntry name attribute.

Returns:
the rootEntry name, null if not set

setRootEntry

public void setRootEntry(String rootEntry)
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

public Vector<ZipEntry> getEntries()
get the vector of zip entries

Returns:

getNextEntry

public ZipEntry getNextEntry()
get the next entry - this can be used in non-buffered mode returns null in case of snafu

Returns:

unPack

public int unPack(File dir)
unpack into a directory

Parameters:
dir - the destination directory
Returns:

unPack

public boolean unPack(File dir,
                      ZipEntry ze)
unpack an individual entry into a directory

Parameters:
dir -
ze -
Returns:

getEntry

public ZipEntry getEntry(String urlString)
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:

getMatchingEntry

public ZipEntry getMatchingEntry(String expr,
                                 int iSkip)
get an entry by name - note that we need to buffer the entire file for this random access method

Parameters:
expr - the regexp to match - simplified regexp is accepted
iSkip - how many to skip - default= 0
Returns:

getInputStream

public InputStream getInputStream()
get the stream to read this from; note that we must close manually

Returns:

getXMLDoc

public XMLDoc getXMLDoc()
get the xmlDoc of the current entry - note not threadsafe!

Returns:

getJDFDoc

public JDFDoc getJDFDoc()
get the xmlDoc of the current entry - note not threadsafe!

Returns:

buffer

public void buffer()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2013. All Rights Reserved.