public ZipEntryInputStream(ZipInputStream zipIn, String fileName) { this.zipIn = zipIn; this.fileName = fileName; // advance the stream to the first zip entry position. hasNext(); }
is.close(); if (is instanceof ZipEntryInputStream) { ((ZipEntryInputStream)is).closeZipInputStream();
InputStream zipfileIn = fs.open(path); ZipInputStream zis = new ZipInputStream(zipfileIn); is = new ZipEntryInputStream(zis, path.toString());
is.close(); if (is instanceof ZipEntryInputStream) { ((ZipEntryInputStream)is).closeZipInputStream();
@Override public int read(byte[] b, int off, int len) throws IOException { int bytes = zipIn.read(); if (bytes == -1) { hasNext(); } if (LOG.isTraceEnabled()) { LOG.trace("bytes read from " + fileName + " " + entryName + ": " + bytes); } return bytes; }
@Override public int read(byte[] buf) throws IOException { int bytes = zipIn.read(buf); if (bytes == -1) { hasNext(); } if (LOG.isTraceEnabled()) { LOG.trace("bytes read from " + fileName + " " + entryName + ": " + bytes); } return bytes; }
@Override public int read() throws IOException { int bytes = zipIn.read(); if (bytes == -1) { // advance the stream to the next entry if done with this one. hasNext(); } if (LOG.isTraceEnabled()) { LOG.trace("bytes read from " + fileName + " " + entryName + ": " + bytes); } return bytes; }