Search in sources :

Example 21 with LinkedBuffer

use of io.protostuff.LinkedBuffer in project incubator-servicecomb-java-chassis by apache.

the class Protostuff method serialize.

@Override
public byte[] serialize(Object model) throws IOException {
    LinkedBuffer linkedBuffer = LinkedBuffer.allocate();
    ProtobufOutput output = new ProtobufOutput(linkedBuffer);
    if (model != null) {
        rootSchema.writeTo(output, (Root) model);
    }
    return output.toByteArray();
}
Also used : LinkedBuffer(io.protostuff.LinkedBuffer) ProtobufOutput(io.protostuff.ProtobufOutput)

Aggregations

LinkedBuffer (io.protostuff.LinkedBuffer)21 ProtobufOutput (io.protostuff.ProtobufOutput)19 Test (org.junit.Test)7 IOException (java.io.IOException)4 BufferOutputStream (io.servicecomb.foundation.vertx.stream.BufferOutputStream)3 RpcException (com.jim.framework.rpc.exception.RpcException)2 ByteArrayInput (io.protostuff.ByteArrayInput)2 Schema (io.protostuff.Schema)2 RuntimeSchema (io.protostuff.runtime.RuntimeSchema)2 Buffer (io.vertx.core.buffer.Buffer)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 Input (io.protostuff.Input)1 ModelProtostuff (io.protostuff.runtime.model.ModelProtostuff)1 MultiWrapper (io.servicecomb.common.javassist.MultiWrapper)1 LoginRequest (io.servicecomb.transport.highway.message.LoginRequest)1 RequestHeader (io.servicecomb.transport.highway.message.RequestHeader)1 List (java.util.List)1 MultiWrapper (org.apache.servicecomb.common.javassist.MultiWrapper)1 BufferOutputStream (org.apache.servicecomb.foundation.vertx.stream.BufferOutputStream)1