}
private void buildDecodingStream() throws IOException {
final int folderIndex = archive.streamMap.fileFolderIndex[currentEntryIndex];
if (folderIndex < 0) {
currentEntryInputStream = new BoundedInputStream(
new ByteArrayInputStream(new byte[0]), 0);
return;
}
final SevenZArchiveEntry file = archive.files[currentEntryIndex];
if (currentFolderIndex == folderIndex) {
// need to advance the folder input stream past the current file
drainPreviousEntry();
file.setContentMethods(archive.files[currentEntryIndex - 1].getContentMethods());
} else {
currentFolderIndex = folderIndex;
if (currentFolderInputStream != null) {
currentFolderInputStream.close();
currentFolderInputStream = null;
}
final Folder folder = archive.folders[folderIndex];
final int firstPackStreamIndex = archive.streamMap.folderFirstPackStreamIndex[folderIndex];
final long folderOffset = SIGNATURE_HEADER_SIZE + archive.packPos +
archive.streamMap.packStreamOffsets[firstPackStreamIndex];
currentFolderInputStream = buildDecoderStack(folder, folderOffset, firstPackStreamIndex, file);
}
final InputStream fileStream = new BoundedInputStream(
currentFolderInputStream, file.getSize());
if (file.getHasCrc()) {
currentEntryInputStream = new CRC32VerifyingInputStream(
fileStream, file.getSize(), file.getCrcValue());
} else {