@Override protected void resetStream() throws IOException { if (stream != null) stream.close(); if (in != null) { in.close(); in = openStream(file); } if (zip != null) zip.close(); zip = new ZipInputStream(in); if (entryName != null) seekToEntry(); stream = new DataInputStream(new BufferedInputStream( zip, RandomAccessInputStream.MAX_OVERHEAD)); stream.mark(RandomAccessInputStream.MAX_OVERHEAD); }
@Override protected void resetStream() throws IOException { if (stream != null) stream.close(); if (in != null) { in.close(); in = openStream(file); } if (zip != null) zip.close(); zip = new ZipInputStream(in); if (entryName != null) seekToEntry(); stream = new DataInputStream(new BufferedInputStream( zip, RandomAccessInputStream.MAX_OVERHEAD)); stream.mark(RandomAccessInputStream.MAX_OVERHEAD); }
/** * Constructs a new ZipHandle corresponding to the given entry of the * specified Zip file. * * @throws HandleException if the given file is not a Zip file. */ public ZipHandle(String file, ZipEntry entry) throws IOException { super(); this.file = file; in = openStream(file); zip = new ZipInputStream(in); entryName = entry.getName(); entryCount = 1; seekToEntry(); resetStream(); length = entry.getSize(); if (length <= 0) { populateLength(); } }
/** * Constructs a new ZipHandle corresponding to the given entry of the * specified Zip file. * * @param file a name that can be passed to * {@link Location#getHandle(String, boolean, boolean)} * @param entry the specific entry in the Zip file to be opened * @throws HandleException if the given file is not a Zip file. * @see ZipEntry */ public ZipHandle(String file, ZipEntry entry) throws IOException { super(); this.file = file; in = openStream(file); zip = new ZipInputStream(in); entryName = entry.getName(); entryCount = 1; seekToEntry(); resetStream(); length = entry.getSize(); if (length <= 0) { populateLength(); } }