List of usage examples for org.apache.commons.compress.archivers.cpio CpioArchiveOutputStream CpioArchiveOutputStream
public CpioArchiveOutputStream(final OutputStream out, final short format)
From source file:org.apache.ant.compress.util.CpioStreamFactory.java
/** * @param stream the stream to write to, should be buffered * @param encoding the encoding of the entry names *//* w w w. j ava2 s. c o m*/ public ArchiveOutputStream getArchiveStream(OutputStream stream, String encoding) throws IOException { return new CpioArchiveOutputStream(stream, encoding); }
From source file:org.apache.tika.parser.pkg.TikaArchiveStreamFactory.java
@Override public ArchiveOutputStream createArchiveOutputStream(final String archiverName, final OutputStream out, final String actualEncoding) throws ArchiveException { if (archiverName == null) { throw new IllegalArgumentException("Archivername must not be null."); }//from w ww . ja v a 2 s . co m if (out == null) { throw new IllegalArgumentException("OutputStream must not be null."); } if (AR.equalsIgnoreCase(archiverName)) { return new ArArchiveOutputStream(out); } if (ZIP.equalsIgnoreCase(archiverName)) { final ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out); if (actualEncoding != null) { zip.setEncoding(actualEncoding); } return zip; } if (TAR.equalsIgnoreCase(archiverName)) { if (actualEncoding != null) { return new TarArchiveOutputStream(out, actualEncoding); } return new TarArchiveOutputStream(out); } if (JAR.equalsIgnoreCase(archiverName)) { if (actualEncoding != null) { return new JarArchiveOutputStream(out, actualEncoding); } return new JarArchiveOutputStream(out); } if (CPIO.equalsIgnoreCase(archiverName)) { if (actualEncoding != null) { return new CpioArchiveOutputStream(out, actualEncoding); } return new CpioArchiveOutputStream(out); } if (SEVEN_Z.equalsIgnoreCase(archiverName)) { throw new StreamingNotSupportedException(SEVEN_Z); } final ArchiveStreamProvider archiveStreamProvider = getArchiveOutputStreamProviders() .get(toKey(archiverName)); if (archiveStreamProvider != null) { return archiveStreamProvider.createArchiveOutputStream(archiverName, out, actualEncoding); } throw new ArchiveException("Archiver: " + archiverName + " not found."); }