Example usage for org.apache.commons.compress.archivers ArchiveOutputStream getClass

List of usage examples for org.apache.commons.compress.archivers ArchiveOutputStream getClass

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers ArchiveOutputStream getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:gov.nih.nci.caarray.application.fileaccess.FileAccessUtils.java

/**
 * This method creates an ArchiveEntry w/o the need of a File required by
 * ArchiveOutputStream.createArchiveEntry(File inputFile, String entryName).
 * // ww  w .  j a  v  a 2s .  com
 * @param aos archive output stream.
 * @param name name of entry.
 * @param size size in bytes of the entry.
 * @return an archive entry that matches the archive stream.
 */
public ArchiveEntry createArchiveEntry(ArchiveOutputStream aos, String name, long size) {
    if (aos instanceof TarArchiveOutputStream) {
        final TarArchiveEntry te = new TarArchiveEntry(name);
        te.setSize(size);
        return te;
    } else if (aos instanceof ZipArchiveOutputStream) {
        final ZipArchiveEntry ze = new ZipArchiveEntry(name);
        ze.setSize(size);
        return ze;
    }
    throw new UnsupportedOperationException("unsupported archive " + aos.getClass());
}