public synchronized void finishInitialization() throws FormatException {
internTableName();
try {
inputFile = new BinaryBufferedFile(filename);
} catch (IOException e) {
throw new FormatException(e.toString());
}
try {
byte preHeaderLen[] = inputFile.readBytes(4, false);
char delim = inputFile.readChar();
switch (delim) {
case 'L':
case 'l':
delim = inputFile.readChar();
//Intentional fall through to set byteorder
case ';': //default is LSB first
byteorder = false;
inputFile.byteOrder(byteorder);
break;
case 'M':
case 'm': //alternatively, it can be MSB first
byteorder = true;
inputFile.byteOrder(byteorder);
delim = inputFile.readChar();
break;
default:
throw new FormatException("Invalid Byte Encoding Format");
}
headerLength += MoreMath.BuildInteger(preHeaderLen, byteorder);
if (delim != ';') {//Sanity check the input
throw new FormatException("Unexpected character in header");
}
tableDescription = inputFile.readToDelimiter(';');
documentationFileName = inputFile.readToDelimiter(';');
if ("-".equals(documentationFileName)) {
documentationFileName = null;
}
ArrayList tmpcols = new ArrayList();
try {
while (true) {
DcwColumnInfo dci = new DcwColumnInfo(inputFile);
int collen = dci.fieldLength();
if ((collen == -1) || (recordLength == -1)) {
recordLength = -1;
} else {
recordLength += collen;
}
tmpcols.add(dci);
}
} catch (EOFException e) {
}
columnInfo = new DcwColumnInfo[tmpcols.size()];
tmpcols.toArray(columnInfo);
cursorRow = 1;
} catch (EOFException e) {
throw new FormatException("Caught EOFException: " + e.getMessage());
} catch (NullPointerException npe) {
}
}