out.writeChar(c);
}
}
public static CompressedSegment readFrom(final byte[] in) throws IOException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(in);
DataInput dis = new DataInputStream(bis);
int totalEntries = dis.readInt();
int bitwidth = dis.readByte();
int firstException = dis.readInt();
int len = dis.readInt();
byte[] b = new byte[len];
dis.readFully(b, 0, len);
FastByteArrayInputStream codesIs = new FastByteArrayInputStream(b);
BitInputStream codesBis = new BitInputStream(codesIs);
int[] codes = new int[totalEntries];
unpack(codesBis, bitwidth, codes, totalEntries);
int exceptions = dis.readShort();
CharArrayList exceptionList = new CharArrayList(exceptions);