Example usage for org.apache.commons.compress.archivers.zip ZipFile getClass

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

Introduction

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

Prototype

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

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:io.github.zlika.reproducible.ZipStripper.java

private InputStream getRawInputStream(ZipFile zip, ZipArchiveEntry ze) throws IOException {
    try {/*from  w ww  . ja  va 2s. c  o m*/
        // Call ZipFile.getRawInputStream(ZipArchiveEntry) by reflection
        // because it is a private method but we need it!
        final Method method = zip.getClass().getDeclaredMethod("getRawInputStream", ZipArchiveEntry.class);
        method.setAccessible(true);
        return (InputStream) method.invoke(zip, ze);
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
        throw new IOException(e);
    }
}