List of usage examples for org.apache.commons.compress.compressors CompressorStreamFactory BZIP2
String BZIP2
To view the source code for org.apache.commons.compress.compressors CompressorStreamFactory BZIP2.
Click Source Link
From source file:com.milaboratory.util.CompressionType.java
private static InputStream createInputStream(CompressionType ct, InputStream is) throws IOException { switch (ct) { case None:// ww w . j a v a 2s .co m return is; case GZIP: return new GZIPInputStream(is, 2048); case BZIP2: CompressorStreamFactory factory = new CompressorStreamFactory(); try { return factory.createCompressorInputStream(CompressorStreamFactory.BZIP2, new BufferedInputStream(is)); } catch (CompressorException e) { throw new IOException(e); } } throw new NullPointerException(); }
From source file:com.mirth.connect.client.ui.panels.export.ArchiveFormat.java
private ArchiveFormat(String archiver, String compressor) { this.archiver = archiver; this.compressor = compressor; if (compressor == null) { label = archiver;/*from w w w . j a v a2 s . c o m*/ } else { if (compressor.equals(CompressorStreamFactory.BZIP2)) { compressor = "bz2"; } label = archiver + "." + compressor; } }
From source file:com.milaboratory.core.io.CompressionType.java
private static InputStream createInputStream(CompressionType ct, InputStream is, int buffer) throws IOException { switch (ct) { case None://ww w. j a v a2s.co m return is; case GZIP: return new GZIPInputStream(is, buffer); case BZIP2: CompressorStreamFactory factory = new CompressorStreamFactory(); try { return factory.createCompressorInputStream(CompressorStreamFactory.BZIP2, new BufferedInputStream(is)); } catch (CompressorException e) { throw new IOException(e); } } throw new NullPointerException(); }
From source file:com.facebook.buck.util.unarchive.Untar.java
public static Untar bzip2Unarchiver() { return new Untar(Optional.of(CompressorStreamFactory.BZIP2)); }
From source file:com.milaboratory.util.CompressionType.java
private static OutputStream createOutputStream(CompressionType ct, OutputStream os) throws IOException { switch (ct) { case None:/* w w w . j a v a 2 s. c o m*/ return os; case GZIP: return new GZIPOutputStream(os, 2048); case BZIP2: CompressorStreamFactory factory = new CompressorStreamFactory(); try { return factory.createCompressorOutputStream(CompressorStreamFactory.BZIP2, new BufferedOutputStream(os)); } catch (CompressorException e) { throw new IOException(e); } } throw new NullPointerException(); }
From source file:com.milaboratory.core.io.CompressionType.java
private static OutputStream createOutputStream(CompressionType ct, OutputStream os, int buffer) throws IOException { switch (ct) { case None://from ww w.j a v a 2 s . c o m return os; case GZIP: return new GZIPOutputStream(os, buffer); case BZIP2: CompressorStreamFactory factory = new CompressorStreamFactory(); try { return factory.createCompressorOutputStream(CompressorStreamFactory.BZIP2, new BufferedOutputStream(os)); } catch (CompressorException e) { throw new IOException(e); } } throw new NullPointerException(); }
From source file:com.mirth.connect.util.messagewriter.MessageWriterFactory.java
private String getArchiveExtension(String archiver, String compressor) { if (compressor == null) { return archiver; }/*from ww w .j a v a 2 s . co m*/ if (compressor.equals(CompressorStreamFactory.BZIP2)) { compressor = "bz2"; } return archiver + "." + compressor; }
From source file:edu.utah.bmi.ibiomes.io.IBIOMESFileReader.java
/** * Get input stream reader/* w ww . ja v a2 s .co m*/ * @param hex Hexadecimal representation of first bits * @return Input stream * @throws CompressorException * @throws IOException */ private CompressorInputStream getInputStreamForCompressedFile(String hex) throws CompressorException, IOException { if (hex.startsWith(HEX_HEADER_BZIP)) compressionScheme = CompressorStreamFactory.BZIP2; else if (hex.startsWith(HEX_HEADER_GZIP)) compressionScheme = CompressorStreamFactory.GZIP; if (compressionScheme != null) { CompressorStreamFactory factory = new CompressorStreamFactory(); CompressorInputStream inputStream = factory.createCompressorInputStream(compressionScheme, new FileInputStream(file)); return inputStream; } else //unsupported { throw new IOException( "Cannot read file " + file.getAbsolutePath() + ". Unsupported compression scheme."); } }
From source file:net.sf.util.zip.FileNameUtil.java
/** * * @param fileName the file name/*w w w . jav a2 s . c o m*/ * @return Compressed file type, as defined in CompressorStreamFactory */ public static String[] getCompressFileType(String fileName) { String s = fileName.toLowerCase(); String[] ret = { null, null }; if (GzipUtils.isCompressedFilename(s)) { ret[0] = CompressorStreamFactory.GZIP; ret[1] = GzipUtils.getUncompressedFilename(fileName); } else if (BZip2Utils.isCompressedFilename(s)) { ret[0] = CompressorStreamFactory.BZIP2; ret[1] = BZip2Utils.getUncompressedFilename(fileName); } else if (XZUtils.isCompressedFilename(s)) { ret[0] = CompressorStreamFactory.XZ; ret[1] = XZUtils.getUncompressedFilename(fileName); } return ret; }
From source file:com.msd.gin.halyard.tools.HalyardExportTest.java
@Test public void testExport_CSV_BZ2() throws Exception { HalyardExport.main(//from ww w. j av a 2 s . c o m new String[] { "-s", TABLE, "-q", TUPLE_QUERY, "-t", ROOT + name.getMethodName() + ".csv.bz2" }); assertEquals(1001, getLinesCount(ROOT + name.getMethodName() + ".csv.bz2", CompressorStreamFactory.BZIP2)); }