Example usage for java.util.zip Deflater getClass

List of usage examples for java.util.zip Deflater getClass

Introduction

In this page you can find the example usage for java.util.zip Deflater getClass.

Prototype

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

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:Main.java

/**
 * Creates a SyncFlush Deflater for use on pre-KitKat Android
 *
 * @return The modified Deflater, or null if the creation failed
 *//*from  ww  w  . jav  a2  s .  co m*/
@Nullable
private static Deflater createSyncFlushDeflater() {
    Deflater def = new Deflater();
    try {
        Field f = def.getClass().getDeclaredField("flushParm");
        f.setAccessible(true);
        f.setInt(def, 2); // Z_SYNC_FLUSH
    } catch (Exception e) {
        return null;
    }
    return def;
}