Example usage for java.util.zip ZipInputStream getClass

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

Introduction

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

Prototype

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

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.seer.datacruncher.streams.ZipStreamTest.java

private boolean isStreamClose(ZipInputStream inStream) {
    try {/*from  w w w  .ja v  a2s  .  co m*/
        Class<?> c = inStream.getClass();
        Field in;
        in = c.getDeclaredField("closed");
        in.setAccessible(true);
        Boolean inReader = (Boolean) in.get(inStream);
        return inReader;
    } catch (Exception e) {
        logger.error(e);
    }
    return false;
}

From source file:com.seer.datacruncher.spring.ValidateFilePopupController.java

/**
 * This method will use to know about the IO Stream is closed or Open.
 * There some issue in ZipInputStream.getNextEntry() some time its throws Exception of 'stream close' instead of return null.
 * So this is a method will get private field [closed] of InputStream class so program could know that stream is open or closed.
 * @return boolean//from  w w  w .  ja v a2s  .co  m
 * It will return true if stream is closed else return false
 */
private boolean isStreamClose(ZipInputStream inStream) {
    try {
        Class c = inStream.getClass();
        Field in;
        in = c.getDeclaredField("closed");
        in.setAccessible(true);
        Boolean inReader = (Boolean) in.get(inStream);
        return inReader;
    } catch (Exception e) {
        logger.error(e);
    }
    return false;
}

From source file:com.seer.datacruncher.services.ftp.FTPPollJobProcessor.java

private boolean isStreamClose(ZipInputStream inStream) {
    try {//from   w  w w.j  ava 2  s . c  o m
        @SuppressWarnings("rawtypes")
        Class c = inStream.getClass();
        Field in;
        in = c.getDeclaredField("closed");
        in.setAccessible(true);
        Boolean inReader = (Boolean) in.get(inStream);
        return inReader;
    } catch (Exception e) {
        log.error(e);
    }
    return false;
}