Author: ebourg Date: Tue Jun 17 06:55:34 2008 New Revision: 668674 URL: http://svn.apache.org/viewvc?rev=668674&view=rev Log: Changed the FileInputStream and FileOutputStream in the method signatures into InputStream and OutputStream
Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractArchive.java commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Archive.java commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Compressor.java commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarArchive.java commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/zip/ZipArchive.java commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/compressors/bzip2/BZip2Compressor.java Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractArchive.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractArchive.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractArchive.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractArchive.java Tue Jun 17 06:55:34 2008 @@ -24,10 +24,10 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.Iterator; - /** * Abstract implementation of an archiver */ @@ -61,7 +61,7 @@ /* (non-Javadoc) * @see org.apache.commons.compress.Archive#save(java.io.FileOutputStream) */ - public void save(FileOutputStream output) throws ArchiveException { + public void save(OutputStream output) throws ArchiveException { doSave(output); } @@ -70,7 +70,7 @@ * @param output - stream to archive to * @throws ArchiveException */ - protected abstract void doSave(FileOutputStream output) throws ArchiveException; + protected abstract void doSave(OutputStream output) throws ArchiveException; /* (non-Javadoc) * @see org.apache.commons.compress.Archive#getArchive() Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/AbstractCompressor.java Tue Jun 17 06:55:34 2008 @@ -49,7 +49,7 @@ /* (non-Javadoc) * @see org.apache.commons.compress.Compressor#compressStream(java.io.FileInputStream) */ - public InputStream compress(FileInputStream input) throws CompressException { + public InputStream compress(InputStream input) throws CompressException { FileOutputStream outputStream = null; FileOutputStream tempFileOutputStream = null; try { @@ -124,7 +124,7 @@ /* (non-Javadoc) * @see org.apache.commons.compress.Decompressor#decompress(java.io.FileInputStream) */ - public InputStream decompress(FileInputStream input) + public InputStream decompress(InputStream input) throws CompressException { File temp; InputStream result; Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Archive.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Archive.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Archive.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Archive.java Tue Jun 17 06:55:34 2008 @@ -20,8 +20,8 @@ import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStream; import java.util.Iterator; /** * Archive is the interface which defines all operations @@ -53,7 +53,7 @@ * @throws ArchiveException if there is no destination file or files to be packed * @return true, if the operation has been ended without exceptions */ - public void save(FileOutputStream output) throws ArchiveException; + public void save(OutputStream output) throws ArchiveException; /** * Packs this file. Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Compressor.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Compressor.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Compressor.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/Compressor.java Tue Jun 17 06:55:34 2008 @@ -19,9 +19,9 @@ package org.apache.commons.compress; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.InputStream; +import java.io.OutputStream; + /** * The Compressor Interface defines all operations for * the compress/decompress actions. @@ -32,11 +32,10 @@ * InputStream to the compressed File * * @param input File to compress - * @return FileInputStream of the compressed file + * @return InputStream of the compressed file * @throws CompressException if the Compressor reports an error */ - public InputStream compress(File input) - throws CompressException; + public InputStream compress(File input) throws CompressException; /** * Compresses this InputStream and returns an @@ -46,8 +45,7 @@ * @return Stream to the compressed file * @throws CompressException if the Compressor reports an error */ - public InputStream compress(FileInputStream input) - throws CompressException; + public InputStream compress(InputStream input) throws CompressException; /** * Compresses the file input and creates a file in the same @@ -56,8 +54,7 @@ * @param input the file to compress * @throws CompressException if the Compressor reports an error */ - public void compressToHere(File input) - throws CompressException; + public void compressToHere(File input) throws CompressException; /** * Creates the file "output" with the compressed @@ -67,8 +64,7 @@ * @param output the file to create * @throws CompressException if the Compressor reports an error */ - public void compressTo(File input, File output) - throws CompressException; + public void compressTo(File input, File output) throws CompressException; /** * Compresses the input stream and writes the compressed @@ -79,24 +75,21 @@ * @param output OutputStream to which the byte shall be written * @throws CompressException if the Compressor reports an error */ - public void compressTo(FileInputStream input, FileOutputStream output) - throws CompressException; + public void compressTo(InputStream input, OutputStream output) throws CompressException; /** * Decompresses a file and returns an InputStream * @param input file to decompress * @return the decompressed file as an inputstream */ - public InputStream decompress(File input) - throws CompressException; + public InputStream decompress(File input) throws CompressException; /** * Decompresses a file and returns an InputStream * @param input inputstream to decompress * @return the decompressed InputStream */ - public InputStream decompress(FileInputStream inputStream) - throws CompressException;; + public InputStream decompress(InputStream inputStream) throws CompressException;; /** * Decompresses this file and writes the decompressed byte to the output file @@ -104,8 +97,7 @@ * @param output File to write the decompressed bytes to * @throws DecompressException if the Compressor reports an error */ - public void decompressTo(File input, File output) - throws CompressException; + public void decompressTo(File input, File output) throws CompressException; /** * Decompresses this file and writes the decompressed file to the output-stream @@ -113,6 +105,5 @@ * @param output Stream to write the decompressed bytes to * @throws DecompressException if the Compressor reports an error */ - public void decompressTo(FileInputStream input, FileOutputStream output) - throws CompressException; + public void decompressTo(InputStream input, OutputStream output) throws CompressException; } Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarArchive.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarArchive.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarArchive.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/tar/TarArchive.java Tue Jun 17 06:55:34 2008 @@ -26,6 +26,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.util.Iterator; import org.apache.commons.compress.AbstractArchive; @@ -123,7 +124,7 @@ /* (non-Javadoc) * @see org.apache.commons.compress.AbstractArchive#doSave(java.io.FileOutputStream) */ - public void doSave(FileOutputStream output) throws ArchiveException { + public void doSave(OutputStream output) throws ArchiveException { // Stream initializing //BufferedInputStream origin = null; Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/zip/ZipArchive.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/zip/ZipArchive.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/zip/ZipArchive.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/archivers/zip/ZipArchive.java Tue Jun 17 06:55:34 2008 @@ -26,6 +26,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.util.Iterator; import java.util.zip.ZipInputStream; @@ -110,7 +111,7 @@ /* (non-Javadoc) * @see org.apache.commons.compress.Archive#pack() */ - protected void doSave(FileOutputStream output) throws ArchiveException { + protected void doSave(OutputStream output) throws ArchiveException { // Stream initializing BufferedInputStream origin = null; Modified: commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/compressors/bzip2/BZip2Compressor.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/compressors/bzip2/BZip2Compressor.java?rev=668674&r1=668673&r2=668674&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/compressors/bzip2/BZip2Compressor.java (original) +++ commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/compressors/bzip2/BZip2Compressor.java Tue Jun 17 06:55:34 2008 @@ -18,9 +18,7 @@ */ package org.apache.commons.compress.compressors.bzip2; -import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -49,13 +47,13 @@ } /* (non-Javadoc) - * @see org.apache.commons.compress.Compressor#compress(java.io.FileInputStream, java.io.FileOutputStream) + * @see org.apache.commons.compress.Compressor#compress(java.io.InputStream, java.io.OutputStream) */ - public void compressTo(FileInputStream inputStream, FileOutputStream outputStream) throws CompressException { + public void compressTo(InputStream in, OutputStream out) throws CompressException { BZip2OutputStream outputBZStream = null; try { - outputBZStream = getPackedOutput( outputStream ); - CompressUtils.copy( inputStream, outputBZStream ); + outputBZStream = getPackedOutput( out ); + CompressUtils.copy( in, outputBZStream ); } catch (FileNotFoundException e) { throw new CompressException("File could not be found", e); } catch (IOException e) { @@ -71,14 +69,13 @@ /* * This decompress method uses a special InputStream Class for BZ2 - * @see org.apache.commons.compress.Compressor#decompress(java.io.FileInputStream, java.io.FileOutputStream) + * @see org.apache.commons.compress.Compressor#decompress(java.io.InputStream, java.io.OutputStream) */ - public void decompressTo(FileInputStream input, FileOutputStream outputStream) - throws CompressException { + public void decompressTo(InputStream in, OutputStream out) throws CompressException { BZip2InputStream inputStream = null; try { - inputStream = getPackedInput( input ); - CompressUtils.copy( inputStream, outputStream ); + inputStream = getPackedInput( in ); + CompressUtils.copy( inputStream, out ); } catch (IOException e) { throw new CompressException("An I/O Exception has occured", e); }