Example usage for org.apache.commons.compress.archivers.tar TarArchiveInputStream reset

List of usage examples for org.apache.commons.compress.archivers.tar TarArchiveInputStream reset

Introduction

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

Prototype

public synchronized void reset() 

Source Link

Document

Since we do not support marking just yet, we do nothing.

Usage

From source file:com.surevine.gateway.scm.IncomingProcessorImpl.java

public boolean tarGzHasExpectedContents(final TarArchiveInputStream archive) {
    Boolean hasMetaData = false;//from w w  w.  j  a  va 2s. c  o m
    Boolean hasBundle = false;
    Integer fileCount = 0;

    TarArchiveEntry entry = null;

    try {
        while ((entry = archive.getNextTarEntry()) != null) {
            if (".metadata.json".equals(entry.getName())) {
                hasMetaData = true;
            } else if (entry.getName().contains(".bundle")) {
                hasBundle = true;
            }
            fileCount++;
        }
        archive.reset();
        return hasMetaData && hasBundle && fileCount == 2;
    } catch (final IOException e) {
        return false;
    }
}