static public HessianInput createHessianInput(InputStream in) { HessianInput hin = new HessianInput(in); hin.setSerializerFactory(_serializerFactory); return hin; }
@Override public <T> T deserialize(byte[] serializedObject, Class<T> objectClass) throws IOException { HessianInput in = new HessianInput(new ByteArrayInputStream(serializedObject)); in.setSerializerFactory(serializerFactory); return objectClass.cast(in.readObject()); }
@Override public <T> T deserialize(InputStream input, Class<T> objectClass) throws IOException { HessianInput in = new HessianInput(input); in.setSerializerFactory(serializerFactory); return objectClass.cast(in.readObject()); } }
public static Object deserialize(byte[] by) throws IOException { if (by == null) throw new NullPointerException(); SerializerFactory serializerFactory = new SerializerFactory(); serializerFactory.addFactory(new BigDecimalSerializerFactory()); ByteArrayInputStream is = new ByteArrayInputStream(by); HessianInput hi = new HessianInput(is); hi.setSerializerFactory(serializerFactory); return hi.readObject(); } }
HessianCauchoInput(InputStream stream) { this.input = new HessianInput(); input.setSerializerFactory(new JMXSerializerFactory()); input.init(stream); }
public static Object cloneViaServerClientSerialization( Serializable object, EntityResolver serverResolver) throws Exception { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); HessianOutput out = new HessianOutput(bytes); out.setSerializerFactory(HessianConfig.createFactory( HessianService.SERVER_SERIALIZER_FACTORIES, serverResolver)); out.writeObject(object); byte[] data = bytes.toByteArray(); HessianInput in = new HessianInput(new ByteArrayInputStream(data)); in.setSerializerFactory(HessianConfig.createFactory( HessianConnection.CLIENT_SERIALIZER_FACTORIES, null)); return in.readObject(); }
public static Object cloneViaServerClientSerialization( Serializable object, EntityResolver serverResolver) throws Exception { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); HessianOutput out = new HessianOutput(bytes); out.setSerializerFactory(HessianConfig.createFactory( HessianService.SERVER_SERIALIZER_FACTORIES, serverResolver)); out.writeObject(object); byte[] data = bytes.toByteArray(); HessianInput in = new HessianInput(new ByteArrayInputStream(data)); in.setSerializerFactory(HessianConfig.createFactory( HessianConnection.CLIENT_SERIALIZER_FACTORIES, null)); return in.readObject(); }
/** * A utility method that clones an object using Hessian serialization/deserialization * mechanism, which is different from default Java serialization. */ public static Object cloneViaClientServerSerialization( Serializable object, EntityResolver serverResolver) throws Exception { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); HessianOutput out = new HessianOutput(bytes); out.setSerializerFactory(HessianConfig.createFactory( HessianConnection.CLIENT_SERIALIZER_FACTORIES, null)); out.writeObject(object); byte[] data = bytes.toByteArray(); HessianInput in = new HessianInput(new ByteArrayInputStream(data)); in.setSerializerFactory(HessianConfig.createFactory( HessianService.SERVER_SERIALIZER_FACTORIES, serverResolver)); return in.readObject(); }
/** * A utility method that clones an object using Hessian serialization/deserialization * mechanism, which is different from default Java serialization. */ public static Object cloneViaClientServerSerialization( Serializable object, EntityResolver serverResolver) throws Exception { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); HessianOutput out = new HessianOutput(bytes); out.setSerializerFactory(HessianConfig.createFactory( HessianConnection.CLIENT_SERIALIZER_FACTORIES, null)); out.writeObject(object); byte[] data = bytes.toByteArray(); HessianInput in = new HessianInput(new ByteArrayInputStream(data)); in.setSerializerFactory(HessianConfig.createFactory( HessianService.SERVER_SERIALIZER_FACTORIES, serverResolver)); return in.readObject(); }
in.setSerializerFactory(getSerializerFactory()); in.init(is);
in.setSerializerFactory(getSerializerFactory()); in.init(is);
@Override protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { ByteBuf frame = (ByteBuf) super.decode(ctx, in); if (frame == null) { return null; } HessianInput hin = new HessianInput(new ByteBufInputStream(frame)); hin.setSerializerFactory(SerializerFactoryUtil.getSerializerFactory()); return hin.readObject(); // ObjectInputStream is = new CompactObjectInputStream(new // ByteBufInputStream(frame), classResolver); // Object result = is.readObject(); // is.close(); // return result; }