}
}
}
public void write(DataOutput out) throws IOException {
Encoder kvEncoder = codec.getEncoder((DataOutputStream) out);
out.writeInt(VERSION_2);
//write out the keyvalues
out.writeInt(kvs.size());
for(KeyValue kv: kvs){
kvEncoder.write(kv);
}
kvEncoder.flush();
out.writeInt(scopes.size());
for (byte[] key : scopes.keySet()) {
Bytes.writeByteArray(out, key);
out.writeInt(scopes.get(key));