Example usage for org.apache.commons.compress.archivers.tar TarArchiveEntry getName

List of usage examples for org.apache.commons.compress.archivers.tar TarArchiveEntry getName

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers.tar TarArchiveEntry getName.

Prototype

public String getName() 

Source Link

Document

Get this entry's name.

Usage

From source file:uni.bielefeld.cmg.sparkhit.io.TextFileBufferInput.java

public boolean setNextTarArchiveEntry() {
    try {//w  w  w  .ja v a2  s  . c  o m
        TarArchiveEntry currentEntry;
        if ((currentEntry = inputTarArchiveStream.getNextTarEntry()) != null) {
            info.readMessage("Reading next TarArchive Entry : " + currentEntry.getName());
            info.screenDump();
            this.inputStreamReader = new InputStreamReader(inputTarArchiveStream);
            setBufferReader();
            return true;
        } else {
            return false;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return false;
}

From source file:utybo.branchingstorytree.swing.utils.BSTPackager.java

public static BranchingStory fromPackage(InputStream in, TabClient client)
        throws IOException, BSTException, InstantiationException, IllegalAccessException {
    TarArchiveInputStream tais = new TarArchiveInputStream(new GZIPInputStream(in));
    VirtualFileHolder vfh = new VirtualFileHolder();
    TarArchiveEntry tae;
    while ((tae = tais.getNextTarEntry()) != null) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        IOUtils.copyLarge(tais, baos, 0, tae.getSize());
        vfh.add(new VirtualFile(baos.toByteArray(), tae.getName()));
    }//  w  w  w. jav a 2  s  . com

    HashMap<String, String> meta = new Gson()
            .fromJson(new InputStreamReader(new ByteArrayInputStream(vfh.getFile("bstmeta.json").getData()),
                    StandardCharsets.UTF_8), new TypeToken<HashMap<String, String>>() {
                    }.getType());
    BranchingStoryTreeParser parser = new BranchingStoryTreeParser();
    BranchingStory bs = parser.parse(new BufferedReader(new InputStreamReader(
            new ByteArrayInputStream(vfh.getFile(meta.get("mainFile")).getData()), StandardCharsets.UTF_8)),
            new Dictionary(), client, "<main>");
    client.setBRMHandler(new BRMVirtualFileClient(vfh, client, bs));
    return bs;
}