for (int i = 0; i < cycles; ++i) {
final File bclFile = bclsForOneTile.get(i);
if (bclFile == null) {
close();
throw new RuntimeIOException(String.format("Could not find BCL file for cycle %d", i));
}
final String filePath = bclFile.getName();
final boolean isGzip = filePath.endsWith(".gz");
final boolean isBgzf = filePath.endsWith(".bgzf");
final InputStream stream = open(bclFile, seekable, isGzip, isBgzf);
final int read = stream.read(byteBuffer.array());
if (read != HEADER_SIZE) {
close();
throw new RuntimeIOException(String.format("BCL %s has invalid header structure.", bclFile.getAbsoluteFile()));
}
numClustersPerCycle[i] = byteBuffer.getInt();
if (!isBgzf && !isGzip) {
assertProperFileStructure(bclFile, numClustersPerCycle[i], stream);
}
this.streams[i] = stream;
byteBuffer.clear();
}
} catch (final IOException ioe) {
throw new RuntimeIOException(ioe);
}
}