public static Buffer messageToByteBuffer(Message msg) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); out.writeBoolean(msg != null); if(msg != null) msg.writeTo(out); return out.getBuffer(); }
public static Buffer messageToByteBuffer(Message msg) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); out.writeBoolean(msg != null); if(msg != null) msg.writeTo(out); return out.getBuffer(); }
public static Buffer messageToByteBuffer(Message msg) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); out.writeBoolean(msg != null); if(msg != null) msg.writeTo(out); return out.getBuffer(); }
public Buffer objectToBuffer(Object obj) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(msg_size + 100); boolean is_mc=obj instanceof MethodCall; out.writeBoolean(is_mc); if(!is_mc) Util.objectToStream(obj, out); else { MethodCall mc=(MethodCall)obj; out.writeShort(mc.getId()); Object[] args=mc.getArgs(); int num_args=args == null? 0 : args.length; out.writeShort(num_args); for(int i=0; i < num_args; i++) Util.objectToStream(args[i], out); } return out.getBuffer(); }
public Buffer objectToBuffer(Object obj) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(msg_size + 100); boolean is_mc=obj instanceof MethodCall; out.writeBoolean(is_mc); if(!is_mc) Util.objectToStream(obj, out); else { MethodCall mc=(MethodCall)obj; out.writeShort(mc.getId()); Object[] args=mc.getArgs(); int num_args=args == null? 0 : args.length; out.writeShort(num_args); for(int i=0; i < num_args; i++) Util.objectToStream(args[i], out); } return out.getBuffer(); }
public Buffer objectToBuffer(Object obj) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(msg_size + 100); boolean is_mc=obj instanceof MethodCall; out.writeBoolean(is_mc); if(!is_mc) Util.objectToStream(obj, out); else { MethodCall mc=(MethodCall)obj; out.writeShort(mc.getId()); Object[] args=mc.getArgs(); int num_args=args == null? 0 : args.length; out.writeShort(num_args); for(int i=0; i < num_args; i++) Util.objectToStream(args[i], out); } return out.getBuffer(); }