Java Code Examples for com.alibaba.com.caucho.hessian.io.Hessian2Input#setSerializerFactory()

The following examples show how to use com.alibaba.com.caucho.hessian.io.Hessian2Input#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: Java8TimeSerializerTest.java    From dubbo-hessian-lite with Apache License 2.0 5 votes vote down vote up
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 2
Source File: HessianUtil.java    From j360-dubbo-app-all with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> T decode(byte[] data) throws IOException {
    Object obj = null;
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    Hessian2Input hessian2Input = new Hessian2Input(in);
    hessian2Input.setSerializerFactory(serializerFactory);

    try {
        obj = hessian2Input.readObject();
    } finally {
        closeableQuietly(in);
        closeQuietly(hessian2Input);
    }
    return (T) obj;
}
 
Example 3
Source File: Hessian2ObjectInput.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
public Hessian2ObjectInput(InputStream is) {
    mH2i = new Hessian2Input(is);
    mH2i.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY);
}
 
Example 4
Source File: Hessian2ObjectInput.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Hessian2ObjectInput(InputStream is)
{
	mH2i = new Hessian2Input(is);
	mH2i.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY);
}
 
Example 5
Source File: Hessian2ObjectInput.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public Hessian2ObjectInput(InputStream is)
{
	mH2i = new Hessian2Input(is);
	mH2i.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY);
}
 
Example 6
Source File: Hessian2ObjectInput.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public Hessian2ObjectInput(InputStream is)
{
	mH2i = new Hessian2Input(is);
	mH2i.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY);
}
 
Example 7
Source File: Hessian2ObjectInput.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Hessian2ObjectInput(InputStream is)
{
	mH2i = new Hessian2Input(is);
	mH2i.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY);
}
 
Example 8
Source File: Hessian2ObjectInput.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Hessian2ObjectInput(InputStream is)
{
	mH2i = new Hessian2Input(is);
	mH2i.setSerializerFactory(Hessian2SerializerFactory.SERIALIZER_FACTORY);
}