tribble.search.zip
Class ZArchive

java.lang.Object
  extended bytribble.search.zip.ZArchive
All Implemented Interfaces:
DocumentSearcherI

public class ZArchive
extends java.lang.Object
implements DocumentSearcherI

Zipfile searcher.

Since:
2001-05-18
Version:
$Revision: 1.5 $ $Date: 2001/06/18 02:56:40 $
Author:
David R. Tribble (david@tribble.com).
Copyright 2001 by David R. Tribble, all rights reserved.
See Also:
ZFile

Field Summary
protected  java.io.File m_fname
          Zipfile filename.
protected  int m_serialNo
          Zipfile open counter.
protected  java.util.zip.ZipFile m_zipfile
          Zipfile file.
static int SERIES
          Series number.
 
Constructor Summary
ZArchive()
          Default constructor.
 
Method Summary
 void close()
          Close this zipfile searcher.
 DocumentI create(java.lang.String name, boolean append)
          Create a new file entry in this zipfile searcher.
 boolean createSupported()
          Determine if new zipfile entries can be created by this searcher.
 java.util.Enumeration find(DocumentFilterI filt)
          Retrieve file entries from this zipfile matching given search criteria.
 void initialize(java.util.Hashtable parms)
          Initialize this searcher.
 void open(java.lang.String path)
          Open a given pathname for this zipfile searcher.
 boolean outputSupported()
          Determine if zipfile entries can be written to this searcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIES

public static final int SERIES
Series number.

See Also:
Constant Field Values

m_fname

protected java.io.File m_fname
Zipfile filename.


m_zipfile

protected java.util.zip.ZipFile m_zipfile
Zipfile file.


m_serialNo

protected int m_serialNo
Zipfile open counter. This counter is incremented every time this zipfile is opened. It is used by ZFile objects to detect whether or not they have become invalidated.

Constructor Detail

ZArchive

public ZArchive()
Default constructor.

Since:
1.1, 2001-05-18
Method Detail

initialize

public void initialize(java.util.Hashtable parms)
Initialize this searcher.

Note: This method does not actually do anything.

Specified by:
initialize in interface DocumentSearcherI
Parameters:
parms - A table containing name/value pairs with which to initialize this zipfile searcher. This can be null.
Since:
1.1, 2001-05-18
See Also:
DocumentSearcherI.open(java.lang.String)

open

public void open(java.lang.String path)
          throws java.io.IOException,
                 java.util.zip.ZipException
Open a given pathname for this zipfile searcher.

Specified by:
open in interface DocumentSearcherI
Parameters:
path - A pathname specifying the location of a zipfile to open and search. This name must specify a filename on the local machine.
Throws:
java.io.IOException - Thrown if the specified path does not exist or is not accessible, or if it is not a regular file, or if it is malformed, or if some other error occurs.
java.util.zip.ZipException
Since:
1.1, 2001-05-18
See Also:
DocumentSearcherI.close(), DocumentSearcherI.initialize(java.util.Hashtable)

close

public void close()
           throws java.io.IOException
Close this zipfile searcher.

Specified by:
close in interface DocumentSearcherI
Throws:
java.io.IOException - Thrown if an error occurs.
Since:
1.1, 2001-05-18
See Also:
DocumentSearcherI.open(java.lang.String)

find

public java.util.Enumeration find(DocumentFilterI filt)
                           throws java.io.IOException,
                                  java.lang.Exception
Retrieve file entries from this zipfile matching given search criteria.

Specified by:
find in interface DocumentSearcherI
Parameters:
filt - A filter specifying file searching criteria. This can be null, in which case all possible file entries for this searcher are returned.
Returns:
A ZIterator object containing an enumeration of ZFile objects representing the list of file entries found by this searcher, or null if there are no matching file entries to be found.
Throws:
java.io.IOException - Thrown if the specified criteria are malformed, or if some other error occurs.
java.lang.Exception - Thrown if the specified criteria are malformed, or if some other error occurs.
Since:
1.4, 2001-06-15

create

public DocumentI create(java.lang.String name,
                        boolean append)
                 throws java.lang.UnsupportedOperationException
Create a new file entry in this zipfile searcher.

Note

This method is not supported.

Parameters:
name - The name of the new file entry to create in this zipfile.
append - Specifies whether or not to append written data to the end of the file.
Returns:
A new file entry corresponding to the newly created file entry.
Throws:
java.lang.UnsupportedOperationException - Thrown, always.
Since:
1.4, 2001-06-15

createSupported

public boolean createSupported()
Determine if new zipfile entries can be created by this searcher.

Returns:
False, always.
Since:
1.1, 2001-06-02

outputSupported

public boolean outputSupported()
Determine if zipfile entries can be written to this searcher.

Specified by:
outputSupported in interface DocumentSearcherI
Returns:
False, always.
Since:
1.1, 2001-06-02