Search in sources :

Example 1 with KryoCallback

use of com.esotericsoftware.kryo.pool.KryoCallback in project jersey by jersey.

the class KryoMessageBodyProvider method writeTo.

@Override
public void writeTo(final Object object, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException, WebApplicationException {
    final Output output = new Output(entityStream);
    kryoPool.run(new KryoCallback() {

        public Object execute(Kryo kryo) {
            kryo.writeObject(output, object);
            return null;
        }
    });
    output.flush();
}
Also used : Output(com.esotericsoftware.kryo.io.Output) KryoCallback(com.esotericsoftware.kryo.pool.KryoCallback) Kryo(com.esotericsoftware.kryo.Kryo)

Aggregations

Kryo (com.esotericsoftware.kryo.Kryo)1 Output (com.esotericsoftware.kryo.io.Output)1 KryoCallback (com.esotericsoftware.kryo.pool.KryoCallback)1