public LogRecordWriter writeObject ( Object object ) throws IOException { if ( object == null ) { return this . writeNullObject ( ) ; } ObjectOutputStream out = null ; try { ByteArrayOutputStream byteOutput = new ByteArrayOutputStream ( ) ; out = new ObjectOutputStream ( byteOutput ) ; out . writeObject ( object ) ; out . flush ( ) ; byte [ ] serBytes = byteOutput . toByteArray ( ) ; io . writeInt ( serBytes . length ) ; io . write ( serBytes ) ; } finally { if ( out != null ) { IOUtils . closeQuietly ( out ) ; } } return this ; }
write the object s class name to check the consistency if the restroe fails .