Пример #1
0
 public void addparam(String id, byte[] body) {
   CSCPPARAM param = new CSCPPARAM();
   param.setId(id);
   param.setBody(body);
   param.build();
   add(param);
 }
Пример #2
0
  public String read(BufferedInputStream bis) throws IOException {
    byte[] version = new byte[CSCP_VERSION_SIZE];
    byte[] bodylen = new byte[CSCP_BODYLEN_SIZE];
    byte[] body = new byte[0];

    bis.read(version, 0, CSCP_VERSION_SIZE);
    bis.read(bodylen, 0, CSCP_BODYLEN_SIZE);
    int ibodylen = Integer.valueOf((new String(bodylen)).trim());
    if (ibodylen > 0) {
      int restlen = ibodylen;
      do {
        CSCPPARAM param = new CSCPPARAM();
        param.read(bis);
        restlen -= param.size();
        add(param);
      } while (restlen > 0);
      body = new byte[ibodylen];
      // bis.read(body, 0, ibodylen);
    }
    return new String(body);
  }