if(tree.keySerializer!=null){
for(int i = 0;i<_keys.size();i++){
if(keys.get(i)==null) continue;
//transform to byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tree.keySerializer.serialize(new SerializerOutput(baos), (K) keys.get(i));
keys.set(i, baos.toByteArray());
}
}
Serialization.writeObject(out, keys);
//write values
for(int i = 0;i<_keys.size();i++){
if(_keys.get(i) == null)
continue;
if(tree.valueSerializer==null)
Serialization.writeObject(out, _values.get(i));
else{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tree.valueSerializer.serialize(new SerializerOutput(baos), _values.get(i));
BPage.writeByteArray(out, baos.toByteArray());
}
}
}