<code>d</code>, in a format that can be read by the constructor {@link
#BitVector(Directory, String)}. */
public final void write(Directory d, String name) throws IOException {
OutputStream output = d.createFile(name);
try {
output.writeInt(size()); // write size
output.writeInt(count()); // write count
output.writeBytes(bits, bits.length); // write bits
} finally {
output.close();
}