Search in sources :

Example 1 with ByteBufferInput

use of io.protostuff.ByteBufferInput in project java-chassis by ServiceComb.

the class WrapSchema method readObject.

@SuppressWarnings("unchecked")
default default <T> T readObject(Buffer buffer) throws Exception {
    if (buffer == null || buffer.length() == 0) {
        // 空串时,protobuf至少为编码为1字节
        return (T) readFromEmpty();
    }
    ByteBuffer nioBuffer = buffer.getByteBuf().nioBuffer();
    Input input = new ByteBufferInput(nioBuffer, false);
    return (T) readObject(input);
}
Also used : Input(io.protostuff.Input) ByteBufferInput(io.protostuff.ByteBufferInput) ByteBufferInput(io.protostuff.ByteBufferInput) ByteBuffer(java.nio.ByteBuffer)

Aggregations

ByteBufferInput (io.protostuff.ByteBufferInput)1 Input (io.protostuff.Input)1 ByteBuffer (java.nio.ByteBuffer)1