Search in sources :

Example 1 with DataInput

use of com.alibaba.dubbo.common.serialize.DataInput in project dubbo by alibaba.

the class DataInputOutputTest method testMain.

public void testMain() throws Exception {
    // write.
    UnsafeByteArrayOutputStream os = new UnsafeByteArrayOutputStream();
    DataOutput cos = new GenericDataOutput(os);
    writeTest(cos);
    // read.
    byte[] b = os.toByteArray();
    DataInput cis = new GenericDataInput(new UnsafeByteArrayInputStream(b));
    readTest(cis);
}
Also used : DataInput(com.alibaba.dubbo.common.serialize.DataInput) GenericDataInput(com.alibaba.dubbo.common.serialize.support.dubbo.GenericDataInput) DataOutput(com.alibaba.dubbo.common.serialize.DataOutput) GenericDataOutput(com.alibaba.dubbo.common.serialize.support.dubbo.GenericDataOutput) GenericDataOutput(com.alibaba.dubbo.common.serialize.support.dubbo.GenericDataOutput) UnsafeByteArrayOutputStream(com.alibaba.dubbo.common.io.UnsafeByteArrayOutputStream) UnsafeByteArrayInputStream(com.alibaba.dubbo.common.io.UnsafeByteArrayInputStream) GenericDataInput(com.alibaba.dubbo.common.serialize.support.dubbo.GenericDataInput)

Aggregations

UnsafeByteArrayInputStream (com.alibaba.dubbo.common.io.UnsafeByteArrayInputStream)1 UnsafeByteArrayOutputStream (com.alibaba.dubbo.common.io.UnsafeByteArrayOutputStream)1 DataInput (com.alibaba.dubbo.common.serialize.DataInput)1 DataOutput (com.alibaba.dubbo.common.serialize.DataOutput)1 GenericDataInput (com.alibaba.dubbo.common.serialize.support.dubbo.GenericDataInput)1 GenericDataOutput (com.alibaba.dubbo.common.serialize.support.dubbo.GenericDataOutput)1