use of org.apache.commons.compress.archivers.tar.TarArchiveOutputStream in project neo4j by neo4j.
the class Dumper method openArchiveOut.
private static ArchiveOutputStream openArchiveOut(Path archive) throws IOException {
// StandardOpenOption.CREATE_NEW is important here because it atomically asserts that the file doesn't
// exist as it is opened, avoiding a TOCTOU race condition which results in a security vulnerability. I
// can't see a way to write a test to verify that we are using this option rather than just implementing
// the check ourselves non-atomically.
TarArchiveOutputStream tarball = new TarArchiveOutputStream(new GzipCompressorOutputStream(Files.newOutputStream(archive, StandardOpenOption.CREATE_NEW)));
tarball.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
tarball.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
return tarball;
}
use of org.apache.commons.compress.archivers.tar.TarArchiveOutputStream in project tika by apache.
the class TarWriter method writeTo.
public void writeTo(Map<String, byte[]> parts, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
TarArchiveOutputStream zip = new TarArchiveOutputStream(entityStream);
for (Map.Entry<String, byte[]> entry : parts.entrySet()) {
tarStoreBuffer(zip, entry.getKey(), entry.getValue());
}
zip.close();
}
use of org.apache.commons.compress.archivers.tar.TarArchiveOutputStream in project gradle by gradle.
the class TarTaskOutputPacker method pack.
@Override
public PackResult pack(SortedSet<ResolvedTaskOutputFilePropertySpec> propertySpecs, Map<String, Map<String, FileContentSnapshot>> outputSnapshots, OutputStream output, TaskOutputOriginWriter writeOrigin) throws IOException {
BufferedOutputStream bufferedOutput;
if (output instanceof BufferedOutputStream) {
bufferedOutput = (BufferedOutputStream) output;
} else {
bufferedOutput = new BufferedOutputStream(output);
}
TarArchiveOutputStream tarOutput = new TarArchiveOutputStream(bufferedOutput, "utf-8");
try {
tarOutput.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
tarOutput.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
tarOutput.setAddPaxHeadersForNonAsciiNames(true);
packMetadata(writeOrigin, tarOutput);
long entryCount = pack(propertySpecs, outputSnapshots, tarOutput);
return new PackResult(entryCount + 1);
} finally {
IOUtils.closeQuietly(tarOutput);
}
}
use of org.apache.commons.compress.archivers.tar.TarArchiveOutputStream in project alluxio by Alluxio.
the class TarUtils method getTarArchiveOutputStream.
private static TarArchiveOutputStream getTarArchiveOutputStream(String path) throws IOException {
// Generate tar.gz file
TarArchiveOutputStream taos = new TarArchiveOutputStream(new GzipCompressorOutputStream(new FileOutputStream(path)));
// TAR has an 8G file limit by default, this gets around that
taos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
// TAR originally does not support long file names, enable the support for it
taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
taos.setAddPaxHeadersForNonAsciiNames(true);
return taos;
}
use of org.apache.commons.compress.archivers.tar.TarArchiveOutputStream in project zeppelin by apache.
the class TarUtils method getTarArchiveOutputStream.
private static TarArchiveOutputStream getTarArchiveOutputStream(String name) throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(name);
GzipCompressorOutputStream gzipOutputStream = new GzipCompressorOutputStream(fileOutputStream);
TarArchiveOutputStream taos = new TarArchiveOutputStream(gzipOutputStream);
// TAR has an 8 gig file limit by default, this gets around that
taos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
// TAR originally didn't support long file names, so enable the support for it
taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
taos.setAddPaxHeadersForNonAsciiNames(true);
return taos;
}
Aggregations