Java Code Examples for org.msgpack.packer.Packer#writeArrayEnd()

The following examples show how to use org.msgpack.packer.Packer#writeArrayEnd() . 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: MessagePackRequestMarshaller.java    From ob1k with Apache License 2.0 6 votes vote down vote up
@Override
public byte[] marshallRequestParams(final Object[] requestParams) throws IOException {

  final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  final Packer packer = msgPack.createPacker(outputStream);

  final Object[] params;
  if (requestParams == null) {
    params = new Object[0];
  } else {
    params = requestParams;
  }

  packer.writeArrayBegin(params.length);
  for (final Object param : params) {
    packer.write(param);
  }
  packer.writeArrayEnd();

  return outputStream.toByteArray();
}
 
Example 2
Source File: ResponseMessage.java    From msgpack-rpc-java with Apache License 2.0 5 votes vote down vote up
public void writeTo(Packer pk) throws IOException {
    pk.writeArrayBegin(4);
    pk.write(Messages.RESPONSE);
    pk.write(msgid);
    pk.write(error);
    pk.write(result);
    pk.writeArrayEnd();
}
 
Example 3
Source File: RequestMessage.java    From msgpack-rpc-java with Apache License 2.0 5 votes vote down vote up
public void writeTo(Packer pk) throws IOException {
    pk.writeArrayBegin(4);
    pk.write(Messages.REQUEST);
    pk.write(msgid);
    pk.write(method);
    pk.writeArrayBegin(args.length);
    for (Object arg : args) {
        pk.write(arg);
    }
    pk.writeArrayEnd();
    pk.writeArrayEnd();
}
 
Example 4
Source File: NotifyMessage.java    From msgpack-rpc-java with Apache License 2.0 5 votes vote down vote up
public void writeTo(Packer pk) throws IOException {
    pk.writeArrayBegin(3);
    pk.write(Messages.NOTIFY);
    pk.write(method);
    pk.writeArrayBegin(args.length);
    for (Object arg : args) {
        pk.write(arg);
    }
    pk.writeArrayEnd();
    pk.writeArrayEnd();
}
 
Example 5
Source File: ArgumentError.java    From msgpack-rpc-java with Apache License 2.0 4 votes vote down vote up
public void messagePack(Packer pk) throws IOException {
    pk.writeArrayBegin(1);
    pk.write(getMessage());
    pk.writeArrayEnd();
}
 
Example 6
Source File: NoMethodError.java    From msgpack-rpc-java with Apache License 2.0 4 votes vote down vote up
public void writeTo(Packer pk) throws IOException {
    pk.writeArrayBegin(1);
    pk.write(getMessage());
    pk.writeArrayEnd();

}