本文整理汇总了Java中com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput.writeDouble方法的典型用法代码示例。如果您正苦于以下问题:Java JacksonObjectOutput.writeDouble方法的具体用法?Java JacksonObjectOutput.writeDouble怎么用?Java JacksonObjectOutput.writeDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.common.serialize.support.json.JacksonObjectOutput
的用法示例。
在下文中一共展示了JacksonObjectOutput.writeDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}