public void write(DataOutput out) throws IOException {
ByteArrayOutputStream b = new ByteArrayOutputStream();
BitOutputStream t = new BitOutputStream(b);
for (int i = 0; i < tf; i++) {
if (i == 0) {
t.writeGamma(positions[0]);
} else {
int pgap = positions[i] - positions[i - 1];
if (positions[i] <= 0 || pgap == 0) {
throw new RuntimeException("Error: invalid term positions " + toString());
}