commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt" <>
Subject Re: [compress] New draft 5
Date Tue, 02 May 2006 11:33:04 GMT
Sorry, joining the party so late ...but this thread let me to actually
have a look ;)

So my comments:

o Don't like that compressor does both compression and decompression.
o Always use File not String
o Please parameter overloading ...this method naming scheme makes
   the API really ugly

But to be a bit more constructive... I would think more of something like:

Compressor compressor = CompressorFactory.newInstance(new File("file.bz2"));
Compressor compressor = CompressorFactory.newInstance("bzip2");
Compressor compressor = new Bzip2Compressor();
Compressor compressor = Bzip2Compressor.getInstance();
File output = compressor.compress(new File("input"));
File output = compressor.compress(new FileInputStream("input"));
InputStream in = compressor.compressStream(new File("input"))
InputStream in = compressor.compressStream(new FileInputStream("input"))
compressor.compressTo(new File("input"), new File("output"));
compressor.compressTo(new FileInputStream("input"), new

Decompressor decompressor = DecompressorFactory.newInstance("bzip2");
File output = decompressor.decompress(new File("input"))
File output = decompressor.decompress(new FileInputStream("input"));
InputStream in = decompressor.decompressStream(new File("input"))
InputStream in = decompressor.decompressStream(new FileInputStream("input"))
decompressor.decompressTo(new File("input"), new File("output"));
decompressor.decompressTo(new FileInputStream("input"), new

Archive arch = new TarArchive(new File("my.tar"));
Archive arch = ArchiveFactory.newInstance(new File("my.tar");
arch.add(new File("input"));
arch.add(new FileInputStream("input"));
arch.delete("path");; File("output")); FileOutputStream("out"));
for(Iterator it = arch.iterator(); it.hasNext(); it) {
  ArchiveEntry entry = (ArchiveEntry);
ArchiveEntry entry = arch.getEntry("path");
entry.extract(new File("output"));
entry.extract(new FileOutputStream("output"));


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message