Class CompressorStreamFactory

  • public class CompressorStreamFactoryextends Object

    Factory to create Compressor[In|Out]putStreams from names. To add other implementations you should extend CompressorStreamFactory and override the appropriate methods (and call their implementation from super of course).

    Example (Compressing a file):
     final OutputStream out = new FileOutputStream(output);  CompressorOutputStream cos =       new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.BZIP2, out); IOUtils.copy(new FileInputStream(input), cos); cos.close(); 
    Example (Decompressing a file):
     final InputStream is = new FileInputStream(input);  CompressorInputStream in =       new CompressorStreamFactory().createCompressorInputStream(CompressorStreamFactory.BZIP2, is); IOUtils.copy(in, new FileOutputStream(output)); in.close(); 
    This class is immutable
    provided that the deprecated method setDecompressConcatenated is not used.
    This class is thread-safe
    even if the deprecated method setDecompressConcatenated is used

Copyright © 2016 The Apache Software Foundation. All rights reserved.

Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14