Java Code Examples for com.alibaba.com.caucho.hessian.io.Hessian2Output#setSerializerFactory()
The following examples show how to use
com.alibaba.com.caucho.hessian.io.Hessian2Output#setSerializerFactory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DubboRequestBody.java From brpc-java with Apache License 2.0 | 6 votes |
public byte[] encodeRequestBody() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Hessian2Output hessian2Output = new Hessian2Output(outputStream); hessian2Output.setSerializerFactory(SERIALIZER_FACTORY); hessian2Output.writeString(dubboProtocolVersion); hessian2Output.writeString(path); hessian2Output.writeString(version); hessian2Output.writeString(methodName); hessian2Output.writeString(ReflectUtils.getDesc(parameterTypes)); if (arguments != null) { for (int i = 0; i < arguments.length; i++) { hessian2Output.writeObject(arguments[i]); } } if (attachments != null) { hessian2Output.writeObject(attachments); } hessian2Output.flushBuffer(); return outputStream.toByteArray(); }
Example 2
Source File: DubboResponseBody.java From brpc-java with Apache License 2.0 | 5 votes |
public byte[] encodeResponseBody() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(DubboConstants.DEFAULT_OUTPUT_BUFFER_SIZE); Hessian2Output hessian2Output = new Hessian2Output(outputStream); hessian2Output.setSerializerFactory(DubboRequestBody.SERIALIZER_FACTORY); hessian2Output.writeInt(responseType); hessian2Output.writeObject(result); if (attachments != null && attachments.size() > 0) { hessian2Output.writeObject(attachments); } hessian2Output.flush(); return outputStream.toByteArray(); }
Example 3
Source File: DubboResponseBody.java From brpc-java with Apache License 2.0 | 5 votes |
public static byte[] encodeErrorResponseBody(String errorMessage) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Hessian2Output hessian2Output = new Hessian2Output(outputStream); hessian2Output.setSerializerFactory(DubboRequestBody.SERIALIZER_FACTORY); hessian2Output.writeString(errorMessage); hessian2Output.flush(); byte[] bodyBytes = outputStream.toByteArray(); return bodyBytes; }
Example 4
Source File: DubboResponseBody.java From brpc-java with Apache License 2.0 | 5 votes |
public static byte[] encodeHeartbeatResponseBody() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Hessian2Output hessian2Output = new Hessian2Output(outputStream); hessian2Output.setSerializerFactory(DubboRequestBody.SERIALIZER_FACTORY); hessian2Output.writeString(DubboConstants.HEARTBEAT_EVENT); hessian2Output.flush(); byte[] bodyBytes = outputStream.toByteArray(); return bodyBytes; }
Example 5
Source File: Java8TimeSerializerTest.java From dubbo-hessian-lite with Apache License 2.0 | 5 votes |
private void testJava8Time(Object expected) throws IOException { os.reset(); Hessian2Output output = new Hessian2Output(os); output.setSerializerFactory(factory); output.writeObject(expected); output.flush(); ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray()); Hessian2Input input = new Hessian2Input(is); input.setSerializerFactory(factory); Object actual = input.readObject(); TestCase.assertEquals(expected, actual); }
Example 6
Source File: HessianUtil.java From j360-dubbo-app-all with Apache License 2.0 | 5 votes |
public static byte[] encode(Object obj) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(1024); Hessian2Output h2o = new Hessian2Output(os); h2o.setSerializerFactory(serializerFactory); try { h2o.writeObject(obj); } finally { closeableQuietly(os); closeQuietly(h2o); } return os.toByteArray(); }
Example 7
Source File: Hessian2ObjectOutput.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
public Hessian2ObjectOutput(OutputStream os) { mH2o = new Hessian2Output(os); mH2o.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY); }
Example 8
Source File: Hessian2ObjectOutput.java From dubbox with Apache License 2.0 | 4 votes |
public Hessian2ObjectOutput(OutputStream os) { mH2o = new Hessian2Output(os); mH2o.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY); }
Example 9
Source File: Hessian2ObjectOutput.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public Hessian2ObjectOutput(OutputStream os) { mH2o = new Hessian2Output(os); mH2o.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY); }
Example 10
Source File: Hessian2ObjectOutput.java From dubbo3 with Apache License 2.0 | 4 votes |
public Hessian2ObjectOutput(OutputStream os) { mH2o = new Hessian2Output(os); mH2o.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY); }
Example 11
Source File: Hessian2ObjectOutput.java From dubbox with Apache License 2.0 | 4 votes |
public Hessian2ObjectOutput(OutputStream os) { mH2o = new Hessian2Output(os); mH2o.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY); }
Example 12
Source File: Hessian2ObjectOutput.java From dubbox with Apache License 2.0 | 4 votes |
public Hessian2ObjectOutput(OutputStream os) { mH2o = new Hessian2Output(os); mH2o.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY); }