Search in sources :

Example 1 with TarHeader

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();
}
Also used : TarOutputStream(org.kamranzafar.jtar.TarOutputStream) TarHeader(org.kamranzafar.jtar.TarHeader) TarEntry(org.kamranzafar.jtar.TarEntry)

Example 2 with TarHeader

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();
}
Also used : TarHeader(org.kamranzafar.jtar.TarHeader) InputStream(java.io.InputStream) TarEntry(org.kamranzafar.jtar.TarEntry) NsiliEndpoint(org.codice.alliance.nsili.endpoint.NsiliEndpoint)

Example 3 with TarHeader

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();
}
Also used : TarHeader(org.kamranzafar.jtar.TarHeader) InputStream(java.io.InputStream) TarEntry(org.kamranzafar.jtar.TarEntry) NsiliEndpoint(org.codice.alliance.nsili.endpoint.NsiliEndpoint)

Aggregations

TarEntry (org.kamranzafar.jtar.TarEntry)3 TarHeader (org.kamranzafar.jtar.TarHeader)3 InputStream (java.io.InputStream)2 NsiliEndpoint (org.codice.alliance.nsili.endpoint.NsiliEndpoint)2 TarOutputStream (org.kamranzafar.jtar.TarOutputStream)1