Java 类com.esotericsoftware.kryo.io.ByteBufferOutputStream 实例源码

项目:kryo-mavenized    文件:InputOutputTest.java   
public void testSmallBuffers() throws Exception {
    ByteBuffer buf = ByteBuffer.allocate(1024);
    ByteBufferOutputStream byteBufferOutputStream = new ByteBufferOutputStream(buf);
    Output testOutput = new Output(byteBufferOutputStream);
    testOutput.writeBytes(new byte[512]);
    testOutput.writeBytes(new byte[512]);
    testOutput.flush();

    ByteBufferInputStream testInputs = new ByteBufferInputStream();
    buf.flip();
    testInputs.setByteBuffer(buf);
    Input input = new Input(testInputs, 512);
    byte[] toRead = new byte[512];
    input.readBytes(toRead);

    input.readBytes(toRead);        
}
项目:JavityEngine    文件:KryoSceneSerializer.java   
public String serialize(JScene sceneToSerialize) {
    Output output = new Output(new ByteBufferOutputStream());
    kryo.writeObject(output, sceneToSerialize);
    return packToString(output);
}