本文整理汇总了Java中com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput类的典型用法代码示例。如果您正苦于以下问题:Java JacksonObjectOutput类的具体用法?Java JacksonObjectOutput怎么用?Java JacksonObjectOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JacksonObjectOutput类属于com.alibaba.dubbo.common.serialize.support.json包,在下文中一共展示了JacksonObjectOutput类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testWrite
import com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput; //导入依赖的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);
}
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:38,代码来源:JacksonTest.java
示例2: serialize
import com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput; //导入依赖的package包/类
public ObjectOutput serialize(OutputStream output) throws IOException {
return new JacksonObjectOutput(output);
}
开发者ID:nince-wyj,项目名称:jahhan,代码行数:4,代码来源:JacksonSerialization.java
示例3: serialize
import com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput; //导入依赖的package包/类
public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
return new JacksonObjectOutput(output);
}
开发者ID:nince-wyj,项目名称:jahhan,代码行数:4,代码来源:JacksonSerialization.java
注:本文中的com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论