Java Code Examples for com.esotericsoftware.kryo.io.Output#setOutputStream()
The following examples show how to use
com.esotericsoftware.kryo.io.Output#setOutputStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Kryo5Codec.java From redisson with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("IllegalCatch") public ByteBuf encode(Object in) throws IOException { Kryo kryo = kryoPool.obtain(); Output output = outputPool.obtain(); ByteBuf out = ByteBufAllocator.DEFAULT.buffer(); try { ByteBufOutputStream baos = new ByteBufOutputStream(out); output.setOutputStream(baos); kryo.writeClassAndObject(output, in); output.flush(); return baos.buffer(); } catch (RuntimeException e) { out.release(); throw e; } finally { kryoPool.free(kryo); outputPool.free(output); } }
Example 2
Source File: FSStorageAgent.java From Bats with Apache License 2.0 | 5 votes |
public static void store(OutputStream stream, Object operator) { synchronized (kryo) { Output output = new Output(4096, Integer.MAX_VALUE); output.setOutputStream(stream); kryo.writeClassAndObject(output, operator); output.flush(); } }
Example 3
Source File: FSStorageAgent.java From attic-apex-core with Apache License 2.0 | 5 votes |
public static void store(OutputStream stream, Object operator) { synchronized (kryo) { Output output = new Output(4096, Integer.MAX_VALUE); output.setOutputStream(stream); kryo.writeClassAndObject(output, operator); output.flush(); } }