* @see loci.formats.FormatReader#initFile(java.lang.String)
*/
@Override
protected void initFile(String id) throws FormatException, IOException {
super.initFile(id);
IRandomAccess is = Location.getHandle(id, false);
is.setOrder(ByteOrder.LITTLE_ENDIAN);
final int cookie = is.readInt();
if (cookie != COOKIE) {
throw new FormatException(String.format("Expected file cookie of %d, but got %d.", COOKIE, cookie));
}
long fileLength = is.length();
records = new ArrayList<IM3Record>();
dataSets = new ArrayList<ContainerRecord>();
spectra = new ArrayList<Spectrum>();
core = new ArrayList<CoreMetadata>();
while (is.getFilePointer() < fileLength) {
final IM3Record rec = parseRecord(is);
if (rec == null) {
if (is.getFilePointer() > fileLength-16) break;
/*
* # of bytes in chunk.
*/
@SuppressWarnings("unused")
final int chunkLength = is.readInt();
/*
* Is always zero? Chunk #?
*/
@SuppressWarnings("unused")
final int unknown = is.readInt();
/*
* Is always one? Chunk #?
*/
@SuppressWarnings("unused")
final int unknown1 = is.readInt();
/*
* # of records to follow
*/
@SuppressWarnings("unused")
final int nRecords = is.readInt();
} else {
if (rec instanceof ContainerRecord) {
final ContainerRecord bRec = (ContainerRecord)rec;
for (IM3Record subDS:bRec.parseChunks(is)) {
if ((subDS instanceof ContainerRecord) && (subDS.name.equals(FIELD_DATA_SET))) {