use of com.mucommander.commons.io.FilterRandomAccessInputStream in project mucommander by mucommander.
the class IsoArchiveFile method getEntryInputStream.
@Override
public InputStream getEntryInputStream(ArchiveEntry entry, ArchiveEntryIterator entryIterator) throws IOException, UnsupportedFileOperationException {
// Cast the entry before creating the stream, in case it fails
IsoArchiveEntry isoEntry = (IsoArchiveEntry) entry;
RandomAccessInputStream rais;
// If a IsoEntryIterator is specified, reuse the iterator's stream
if (entryIterator != null && entryIterator instanceof IsoEntryIterator) {
// Override close() as a no-op so that the stream is re-used from one entry to another -- the stream will
// be closed when the iterator is closed.
rais = new FilterRandomAccessInputStream(((IsoEntryIterator) entryIterator).getRandomAccessInputStream()) {
@Override
public void close() throws IOException {
// No-op
}
};
} else {
rais = getRandomAccessInputStream();
}
return new IsoEntryInputStream(rais, isoEntry);
}
Aggregations