public static < T > void writeKryo ( T obj , OutputStream file ) { try { Output output = new Output ( buffer . get ( ) ) ; new KryoReflectionFactorySupport ( ) . writeClassAndObject ( output , obj ) ; output . close ( ) ; IOUtils . write ( CompressionUtil . encodeBZ ( Arrays . copyOf ( output . getBuffer ( ) , output . position ( ) ) ) , file ) ; file . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Write kryo .