use of org.kamranzafar.jtar.TarHeader in project gradle by gradle.
the class JTarPacker method pack.
@Override
public void pack(List<DataSource> inputs, DataTarget output) throws IOException {
TarOutputStream tarOutput = new TarOutputStream(output.openOutput());
for (DataSource input : inputs) {
@SuppressWarnings("OctalInteger") TarHeader header = TarHeader.createHeader(input.getName(), input.getLength(), 0, false, 0644);
TarEntry entry = new TarEntry(header);
tarOutput.putNextEntry(entry);
PackerUtils.packEntry(input, tarOutput, buffer);
}
tarOutput.close();
}
use of org.kamranzafar.jtar.TarHeader in project alliance by codice.
the class OrderRequestImpl method getTar.
private void getTar(TarOutputStream tarOut, List<ResourceContainer> files) throws IOException {
long modTime = System.currentTimeMillis() / 1000;
int permissions = DEFAULT_TAR_PERMISSION;
for (ResourceContainer file : files) {
TarHeader fileHeader = TarHeader.createHeader(file.getName(), file.getSize(), modTime, false, permissions);
tarOut.putNextEntry(new TarEntry(fileHeader));
try (InputStream fileInputStream = file.getInputStream()) {
IOUtils.copy(fileInputStream, tarOut);
}
}
tarOut.flush();
}
use of org.kamranzafar.jtar.TarHeader in project alliance by codice.
the class OrderRequestImpl method getTar.
private void getTar(TarOutputStream tarOut, ResourceContainer file) throws IOException {
long modTime = System.currentTimeMillis() / 1000;
int permissions = DEFAULT_TAR_PERMISSION;
TarHeader fileHeader = TarHeader.createHeader(file.getName(), file.getSize(), modTime, false, permissions);
tarOut.putNextEntry(new TarEntry(fileHeader));
try (InputStream fileInputStream = file.getInputStream()) {
IOUtils.copy(fileInputStream, tarOut);
}
tarOut.flush();
}
Aggregations