Package org.apache.commons.compress.compressors

Examples of org.apache.commons.compress.compressors.CompressorStreamFactory


    if (doBzipCompression) {
      // Wrap with BOS since BZip2CompressorOutputStream calls out.write(int)
      // and does not use the write(byte[]) version. This proved to speed the
      // compression process by 70% !
      out = new BufferedOutputStream(out, 1 << 16);
      out = new CompressorStreamFactory().createCompressorOutputStream("bzip2", out);
    }
    lineFileOut = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), 1 << 16);
    docMaker = runData.getDocMaker();
  }
View Full Code Here


      source.start();

      // Create compressed archive
      OutputStream outGzipFileStream = new FileOutputStream(path + name + ".tar.gz");

      GzipCompressorOutputStream outGzipStream = (GzipCompressorOutputStream)new CompressorStreamFactory()
      .createCompressorOutputStream(CompressorStreamFactory.GZIP, outGzipFileStream);

      IOUtils.copy(inTarFileStream, outGzipStream);
      inTarFileStream.close();
View Full Code Here

    return f;
  }
 
  private File rawGzipFile(String ext) throws Exception {
    File f = new File(testDir,"testfile." +  ext);
    OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.GZIP, new FileOutputStream(f));
    writeText(os);
    return f;
  }
View Full Code Here

    return f;
  }

  private File rawBzip2File(String ext) throws Exception {
    File f = new File(testDir,"testfile." +  ext);
    OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.BZIP2, new FileOutputStream(f));
    writeText(os);
    return f;
  }
View Full Code Here

        FileOutputStream out = null;
        CompressorInputStream compressorIn = null;
        try {
            in = new BufferedInputStream(new FileInputStream(file));
            out = new FileOutputStream(tempFile);
            compressorIn = new CompressorStreamFactory().createCompressorInputStream(in);
            final byte[] buffer = new byte[1024];
            int i;
            while ((i = compressorIn.read(buffer)) != -1) {
                out.write(buffer, 0, i);
            }
View Full Code Here

        }
    }

    private static MediaType detectCompressorFormat(byte[] prefix, int length) {
        try {
            CompressorStreamFactory factory = new CompressorStreamFactory();
            CompressorInputStream cis = factory.createCompressorInputStream(
                    new ByteArrayInputStream(prefix, 0, length));
            try {
                return CompressorParser.getMediaType(cis);
            } finally {
                IOUtils.closeQuietly(cis);
View Full Code Here

        // Ensure that the stream supports the mark feature
        stream = new BufferedInputStream(stream);

        CompressorInputStream cis;
        try {
            CompressorStreamFactory factory = new CompressorStreamFactory();
            cis = factory.createCompressorInputStream(stream);
        } catch (CompressorException e) {
            throw new TikaException("Unable to uncompress document stream", e);
        }

        MediaType type = getMediaType(cis);
View Full Code Here

        }
    }

    private static MediaType detectCompressorFormat(byte[] prefix, int length) {
        try {
            CompressorStreamFactory factory = new CompressorStreamFactory();
            CompressorInputStream cis = factory.createCompressorInputStream(
                    new ByteArrayInputStream(prefix, 0, length));
            try {
                return CompressorParser.getMediaType(cis);
            } finally {
                IOUtils.closeQuietly(cis);
View Full Code Here

    return f;
  }
 
  private File rawGzipFile(String ext) throws Exception {
    File f = new File(testDir,"testfile." +  ext);
    OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.GZIP, new FileOutputStream(f));
    writeText(os);
    return f;
  }
View Full Code Here

    return f;
  }

  private File rawBzip2File(String ext) throws Exception {
    File f = new File(testDir,"testfile." +  ext);
    OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.BZIP2, new FileOutputStream(f));
    writeText(os);
    return f;
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.compress.compressors.CompressorStreamFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.