[Ejtools-cvs] libraries/common/src/main/org/ejtools/archive/io package.html,NONE,1.1 ByteReader.java
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 10:50:08
|
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io In directory sc8-pr-cvs1:/tmp/cvs-serv18971/common/src/main/org/ejtools/archive/io Modified Files: ByteReader.java DirectoryWriter.java FileReader.java FileWriter.java Reader.java StreamReader.java StreamWriter.java Writer.java Added Files: package.html Log Message: Add more javadocs. Add package.html files. --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!-- EJTools, the Enterprise Java Tools Distributable under LGPL license. See terms of license at www.gnu.org. $Revision: 1.1 $ --> <html> <head/> <body> Provides the underlying read and write operation for the Archive IO system (Stream and File based). </body> </html> Index: ByteReader.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/ByteReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ByteReader.java 15 Sep 2003 23:14:31 -0000 1.1 --- ByteReader.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 12,15 **** --- 12,17 ---- /** + * Reader implementation based on a byte array. The stream is build onto the byte array. + * * @author Laurent Etiemble * @version $Revision$ *************** *** 18,22 **** { /** ! *Constructor for the FileMapper object * * @param content Description of the Parameter --- 20,24 ---- { /** ! * Builds a ByteReader on a byte array * * @param content Description of the Parameter Index: DirectoryWriter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/DirectoryWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DirectoryWriter.java 15 Sep 2003 23:14:31 -0000 1.1 --- DirectoryWriter.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 17,20 **** --- 17,22 ---- /** + * Writer implementation based on file-system directory. Each Archive will be output as a directory, and each Entry as a file. + * * @author Laurent Etiemble * @version $Revision$ *************** *** 22,33 **** public class DirectoryWriter implements Writer { ! /** Description of the Field */ private Stack outDirs = new Stack(); /** ! *Constructor for the ArchiveWriter object * ! * @param basedir Description of the Parameter */ public DirectoryWriter(File basedir) --- 24,35 ---- public class DirectoryWriter implements Writer { ! /** Stacks of the current output directories */ private Stack outDirs = new Stack(); /** ! * Build the Writer on a directory. * ! * @param basedir The root directory */ public DirectoryWriter(File basedir) *************** *** 38,44 **** /** ! * Description of the Method * ! * @param archive Description of the Parameter */ public void visit(Archive archive) --- 40,46 ---- /** ! * Visit an archive. Each Archive will be output as a directory. * ! * @param archive The archive to visit */ public void visit(Archive archive) *************** *** 50,53 **** --- 52,56 ---- } + // For each archive, output its content for (Iterator iterator = archive.iterator(); iterator.hasNext(); ) { *************** *** 70,76 **** /** ! * Description of the Method * ! * @param entry Description of the Parameter */ public void visit(Entry entry) --- 73,79 ---- /** ! * Visit an entry. Each Entry will be output as a file. * ! * @param entry The entry to visit */ public void visit(Entry entry) *************** *** 83,86 **** --- 86,91 ---- throw new IllegalStateException("No initial uri"); } + + // Create the file and dump the content File file = new File(uri, entry.getURI()); file.getParentFile().mkdirs(); Index: FileReader.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/FileReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileReader.java 15 Sep 2003 23:14:31 -0000 1.1 --- FileReader.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 13,16 **** --- 13,18 ---- /** + * Reader implementation based on a File. The file is transformed into a stream. + * * @author Laurent Etiemble * @version $Revision$ *************** *** 19,25 **** { /** ! *Constructor for the FileMapper object * ! * @param file Description of the Parameter */ public FileReader(File file) --- 21,27 ---- { /** ! * Builds a FileReader on a File * ! * @param file The File to read */ public FileReader(File file) Index: FileWriter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/FileWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileWriter.java 15 Sep 2003 23:14:31 -0000 1.1 --- FileWriter.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 13,16 **** --- 13,18 ---- /** + * Writer implementation based on a File. The file is transformed into a stream. + * * @author Laurent Etiemble * @version $Revision$ *************** *** 19,25 **** { /** ! *Constructor for the ArchiveWriter object * ! * @param file Description of the Parameter */ public FileWriter(File file) --- 21,27 ---- { /** ! * Builds a FileWriter on a File * ! * @param file The File to write */ public FileWriter(File file) Index: Reader.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/Reader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Reader.java 15 Sep 2003 23:14:31 -0000 1.1 --- Reader.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 12,15 **** --- 12,17 ---- /** + * Interface that describe a Reader used to build Archive and Entry. Use the Visitor Pattern. + * * @author Laurent Etiemble * @version $Revision$ *************** *** 18,24 **** { /** ! * Description of the Method * ! * @param archive Description of the Parameter */ public void visit(Archive archive); --- 20,26 ---- { /** ! * Visit an archive. * ! * @param archive The archive to visit */ public void visit(Archive archive); *************** *** 26,32 **** /** ! * Description of the Method * ! * @param entry Description of the Parameter */ public void visit(Entry entry); --- 28,34 ---- /** ! * Visit an entry. * ! * @param entry The entry to visit */ public void visit(Entry entry); Index: StreamReader.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/StreamReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StreamReader.java 15 Sep 2003 23:14:31 -0000 1.1 --- StreamReader.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 21,24 **** --- 21,28 ---- /** + * Reader implementation based on stream. + * <p>Each Archive and each Entry will be created through a ZipInputStream. This classe serves as parent for derived ones.</p> + * <p>As the structure is dynamically created, the Visitor Pattern cannot be strictly followed.</p> + * * @author Laurent Etiemble * @version $Revision$ *************** *** 26,47 **** public abstract class StreamReader implements Reader { ! /** Description of the Field */ private Stack inStreams = new Stack(); /** ! * Description of the Method * ! * @param entry Description of the Parameter */ ! public void visit(Entry entry) ! { ! } /** ! * Description of the Method * ! * @param archive Description of the Parameter */ public void visit(Archive archive) --- 30,49 ---- public abstract class StreamReader implements Reader { ! /** Stacks of the current input streams */ private Stack inStreams = new Stack(); /** ! * Visit an entry. Do nothing. * ! * @param entry The entry to visit */ ! public void visit(Entry entry) { } /** ! * Visit an archive. Each Archive will be build from a ZipInputStream and populated with entries. * ! * @param archive The archive to visit */ public void visit(Archive archive) *************** *** 78,85 **** /** ! * Description of the Method * ! * @param uri Description of the Parameter ! * @return Description of the Return Value */ protected Entry createEntry(String uri) --- 80,87 ---- /** ! * Helper method to create an entry. * ! * @param uri The URI of the entry ! * @return The new Entry */ protected Entry createEntry(String uri) *************** *** 143,149 **** /** ! * Gets the stream attribute of the FileMapper object * ! * @return The stream value */ protected ZipInputStream getZipInputStream() --- 145,151 ---- /** ! * Returns the current stream * ! * @return The current stream */ protected ZipInputStream getZipInputStream() *************** *** 154,161 **** /** ! * Gets the stream attribute of the FileMapper object * ! * @return The stream value ! * @exception IOException Description of the Exception */ protected ZipInputStream popZipInputStream() --- 156,163 ---- /** ! * Pops the last entered stream * ! * @return The stream ! * @exception IOException If no stream is available */ protected ZipInputStream popZipInputStream() *************** *** 174,181 **** /** ! * Description of the Method * ! * @param stream Description of the Parameter ! * @exception IOException Description of the Exception */ protected void pushZipInputStream(ZipInputStream stream) --- 176,183 ---- /** ! * Pushes a stream onto the stack * ! * @param stream The stream ! * @exception IOException Shoud never occured */ protected void pushZipInputStream(ZipInputStream stream) Index: StreamWriter.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/StreamWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StreamWriter.java 15 Sep 2003 23:14:31 -0000 1.1 --- StreamWriter.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 18,34 **** /** * @author Laurent Etiemble * @version $Revision$ */ ! public class StreamWriter implements Writer { ! /** Description of the Field */ private Stack outStreams = new Stack(); /** ! * Description of the Method * ! * @param archive Description of the Parameter */ public void visit(Archive archive) --- 18,36 ---- /** + * Writer implementation based on stream. Each Archive and each Entry will be output through a ZipOutputStream. This classe serves as parent for derived ones. + * * @author Laurent Etiemble * @version $Revision$ */ ! public abstract class StreamWriter implements Writer { ! /** Stacks of the current output streams */ private Stack outStreams = new Stack(); /** ! * Visit an archive. A new ZipOutputStream is created for each Archive. * ! * @param archive The archive to visit */ public void visit(Archive archive) *************** *** 42,45 **** --- 44,48 ---- } + // For each archive, output its content for (Iterator iterator = archive.iterator(); iterator.hasNext(); ) { *************** *** 74,80 **** /** ! * Description of the Method * ! * @param entry Description of the Parameter */ public void visit(Entry entry) --- 77,83 ---- /** ! * Visit an entry. * ! * @param entry The entry to visit */ public void visit(Entry entry) *************** *** 82,85 **** --- 85,89 ---- try { + // Gets the current stream and dump the content ZipOutputStream stream = this.getZipOutputStream(); if (stream == null) *************** *** 99,105 **** /** ! * Gets the stream attribute of the FileMapper object * ! * @return The stream value */ protected ZipOutputStream getZipOutputStream() --- 103,109 ---- /** ! * Returns the current stream * ! * @return The current stream */ protected ZipOutputStream getZipOutputStream() *************** *** 110,117 **** /** ! * Gets the stream attribute of the FileMapper object * ! * @return The stream value ! * @exception IOException Description of the Exception */ protected ZipOutputStream popZipOutputStream() --- 114,121 ---- /** ! * Pops the last entered stream * ! * @return The stream ! * @exception IOException If no stream is available */ protected ZipOutputStream popZipOutputStream() *************** *** 130,137 **** /** ! * Description of the Method * ! * @param stream Description of the Parameter ! * @exception IOException Description of the Exception */ protected void pushZipOutputStream(ZipOutputStream stream) --- 134,141 ---- /** ! * Pushes a stream onto the stack * ! * @param stream The stream ! * @exception IOException Shoud never occured */ protected void pushZipOutputStream(ZipOutputStream stream) Index: Writer.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/archive/io/Writer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Writer.java 15 Sep 2003 23:14:31 -0000 1.1 --- Writer.java 13 Dec 2003 21:27:49 -0000 1.2 *************** *** 12,15 **** --- 12,17 ---- /** + * Interface that describe a Writer used to dump the Archive and Entry. Use the Visitor Pattern. + * * @author Laurent Etiemble * @version $Revision$ *************** *** 18,24 **** { /** ! * Description of the Method * ! * @param archive Description of the Parameter */ public void visit(Archive archive); --- 20,26 ---- { /** ! * Visit an archive. * ! * @param archive The archive to visit */ public void visit(Archive archive); *************** *** 26,32 **** /** ! * Description of the Method * ! * @param entry Description of the Parameter */ public void visit(Entry entry); --- 28,34 ---- /** ! * Visit an entry. * ! * @param entry The entry to visit */ public void visit(Entry entry); |