outputStream = new DataOutputStream(out);
}
public void serialize(Object o) throws IOException {
// The outputs are borrowed in a clean state, ready to use
SerDeState st = kryoPool.borrow();
try {
st.writeObject(o);
// Copy from buffer to output stream.
outputStream.writeInt(st.numOfWrittenBytes());
st.writeOutputTo(outputStream);
}
finally {
kryoPool.release(st);
}
outputStream.flush();