本文整理汇总了Java中com.alibaba.dubbo.common.serialize.support.json.JacksonObjectInput类的典型用法代码示例。如果您正苦于以下问题:Java JacksonObjectInput类的具体用法?Java JacksonObjectInput怎么用?Java JacksonObjectInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JacksonObjectInput类属于com.alibaba.dubbo.common.serialize.support.json包,在下文中一共展示了JacksonObjectInput类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWrite
import com.alibaba.dubbo.common.serialize.support.json.JacksonObjectInput; //导入依赖的package包/类
@Test
public void testWrite() throws Exception{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JacksonObjectOutput output = new JacksonObjectOutput(bos);
// PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));
output.writeUTF("2.0.0");
output.writeBool(true);
output.writeByte((byte) 2);
output.writeBytes(new String("abc").getBytes());
output.writeDouble(2.0d);
output.writeFloat(3.05f);
output.writeInt(32);
output.writeLong(64L);
output.writeShort((short) 16);
output.writeBytes(new String("afdsafdsafsa").getBytes(), 6, 4);
output.writeObject(new String[]{"abc", "def", "gfk"});
output.writeObject(new int[]{4,5,8});
output.writeObject(new JacksonBean());
output.flushBuffer();
JacksonObjectInput input = new JacksonObjectInput(new ByteArrayInputStream(bos.toByteArray()));
System.out.println(input.readUTF());
System.out.println(input.readBool());
System.out.println(input.readByte());
System.out.println(new String(input.readBytes()));
System.out.println(input.readDouble());
System.out.println(input.readFloat());
System.out.println(input.readInt());
System.out.println(input.readLong());
System.out.println(input.readShort());
System.out.println(Arrays.toString(input.readBytes()));
System.out.println(Arrays.toString(input.readObject(String[].class)));
System.out.println(Arrays.toString(input.readObject(int[].class)));
JacksonBean jacksonBean = input.readObject(JacksonBean.class);
System.out.println(jacksonBean);
}
示例2: deserialize
import com.alibaba.dubbo.common.serialize.support.json.JacksonObjectInput; //导入依赖的package包/类
public ObjectInput deserialize(InputStream input) throws IOException {
return new JacksonObjectInput(input);
}
示例3: deserialize
import com.alibaba.dubbo.common.serialize.support.json.JacksonObjectInput; //导入依赖的package包/类
public ObjectInput deserialize(URL url, InputStream input) throws IOException {
return new JacksonObjectInput(input);
}