/*
* Reads in format code and decompresses character accordingly.
*/
try {
int code;
// Read in and ignore empty bytes (NOP's) as long as they
// arrive.
do {
code = readCode();
} while (code == NOP);
if (code >= BASE) {
// Retrieve index of character in codeTable if the
// code is in the correct range.
return codeTable.charAt(code - BASE);
} else if (code == RAW) {
// read in the lower 4 bits and the higher 4 bits,
// and return the reconstructed character
int high = readCode();
int low = readCode();
return (high << 4) | low;
} else
throw new IOException("unknown compression code: " + code);
} catch (EOFException e) {
// Return the end of file code
return -1;
}