protected final synchronized byte [ ] objectToArray ( Object val ) throws IOException { final ByteArrayOutputStream bos = new InitiallyReusableByteArrayOutputStream ( getReusableByteBuffer ( ) ) ; final ObjectOutputStream oos = new ObjectOutputStream ( bos ) ; oos . writeObject ( val ) ; return bos . toByteArray ( ) ; }
Converts an object to byte array .