Example #1
0
  /** Creates an XMLRPC call from the given method name and parameters and sends it */
  protected void writeCall(String methodName, Object[] args) throws Exception {
    huc = u.openConnection();
    huc.setDoOutput(true);
    huc.setDoInput(true);
    huc.setUseCaches(false);
    huc.setRequestProperty("Content-Type", "binary/message-pack");
    huc.setReadTimeout(0);
    OutputStream os = huc.getOutputStream();
    Packer pk = new Packer(os);

    pk.packArray(args.length + 1);
    pk.pack(methodName);
    for (Object o : args) pk.pack(o);
    os.close();
  }
 @Override
 @SuppressWarnings("unchecked")
 public void pack(Packer pk, Object obj) throws IOException {
   if (obj instanceof Map) {
     Map d = (Map) obj;
     pk.packArray(fields.length);
     for (int i = 0; i < fields.length; ++i) {
       FieldSchema f = fields[i];
       f.getSchema().pack(pk, d.get(f.getName()));
     }
   } else if (obj == null) {
     pk.packNil();
   } else {
     throw MessageTypeException.invalidConvert(obj, this);
   }
 }
Example #3
0
 public void pack(Packer pk, Object target) throws IOException {
   pk.packByte((Byte) target);
 }
Example #4
0
 @Override
 public void pack(Packer pk, Object obj) throws IOException {
   pk.pack(obj);
 }
 @Override
 public void messagePack(Packer packer) throws IOException {
   packer.packArray(2);
   packer.pack(f0);
   packer.pack(f1);
 }