use of org.kamranzafar.jtar.TarEntry in project gradle by gradle.
the class JTarPacker method unpack.
@Override
public void unpack(DataSource input, DataTargetFactory targetFactory) throws IOException {
TarInputStream tarInput = new TarInputStream(input.openInput());
while (true) {
TarEntry entry = tarInput.getNextEntry();
if (entry == null) {
break;
}
PackerUtils.unpackEntry(entry.getName(), tarInput, buffer, targetFactory);
}
tarInput.close();
}
use of org.kamranzafar.jtar.TarEntry 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.TarEntry 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.TarEntry 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