org.ejtools.archive.io
Class StreamReader

java.lang.Object
  |
  +--org.ejtools.archive.io.StreamReader
All Implemented Interfaces:
Reader
Direct Known Subclasses:
ByteReader, FileReader

public abstract class StreamReader
extends java.lang.Object
implements Reader

Reader implementation based on stream.

Each Archive and each Entry will be created through a ZipInputStream. This classe serves as parent for derived ones.

As the structure is dynamically created, the Visitor Pattern cannot be strictly followed.

Version:
$Revision: 1.2 $
Author:
Laurent Etiemble

Constructor Summary
StreamReader()
           
 
Method Summary
protected  Entry createEntry(java.lang.String uri)
          Helper method to create an entry.
protected  java.util.zip.ZipInputStream getZipInputStream()
          Returns the current stream
protected  java.util.zip.ZipInputStream popZipInputStream()
          Pops the last entered stream
protected  void pushZipInputStream(java.util.zip.ZipInputStream stream)
          Pushes a stream onto the stack
 void visit(Archive archive)
          Visit an archive.
 void visit(Entry entry)
          Visit an entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamReader

public StreamReader()
Method Detail

visit

public void visit(Entry entry)
Visit an entry. Do nothing.

Specified by:
visit in interface Reader
Parameters:
entry - The entry to visit

visit

public void visit(Archive archive)
Visit an archive. Each Archive will be build from a ZipInputStream and populated with entries.

Specified by:
visit in interface Reader
Parameters:
archive - The archive to visit

createEntry

protected Entry createEntry(java.lang.String uri)
Helper method to create an entry.

Parameters:
uri - The URI of the entry
Returns:
The new Entry

getZipInputStream

protected java.util.zip.ZipInputStream getZipInputStream()
Returns the current stream

Returns:
The current stream

popZipInputStream

protected java.util.zip.ZipInputStream popZipInputStream()
                                                  throws java.io.IOException
Pops the last entered stream

Returns:
The stream
Throws:
java.io.IOException - If no stream is available

pushZipInputStream

protected void pushZipInputStream(java.util.zip.ZipInputStream stream)
                           throws java.io.IOException
Pushes a stream onto the stack

Parameters:
stream - The stream
Throws:
java.io.IOException - Shoud never occured


Copyright © 2002-2003 EJTools Org.. All Rights Reserved.