/** * Constructor RawDataBlockList * * @param stream the InputStream from which the data will be read * @exception IOException on I/O errors, and if an incomplete block is read */ public RawDataBlockList(final RandomAccessInputStream stream, int size) throws IOException { List blocks = new ArrayList(); bigBlockSize = size; while (true) { RawDataBlock block = new RawDataBlock(stream, size); if (block.eof()) { break; } blocks.add(block); if (size + stream.getFilePointer() > stream.length()) { break; } stream.skipBytes(size); } setBlocks((RawDataBlock[]) blocks.toArray(new RawDataBlock[0])); }
/* @see IRandomAccess#close() */ @Override public void close() throws IOException { super.close(); zip = null; entryName = null; if (in != null) in.close(); in = null; entryCount = 0; }
/* @see StreamHandle#resetStream() */ @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); }