Class ZPicture

java.lang.Object
org.zeromq.proto.ZPicture

public class ZPicture extends Object
De/serialization of data within a message. This is a DRAFT class, and may change without notice.
  • Constructor Details

    • ZPicture

      public ZPicture()
  • Method Details

    • msgBinaryPicture

      public ZMsg msgBinaryPicture(String picture, Object... args)
      Creates a binary encoded 'picture' message to the socket (or actor), so it can be sent. The arguments are encoded in a binary format that is compatible with zproto, and is designed to reduce memory allocations.
      Parameters:
      picture - The picture argument is a string that defines the type of each argument. Supports these argument types:

      Types of arguments
      patternjava typezproto type
      1inttype = "number" size = "1"
      2inttype = "number" size = "2"
      4longtype = "number" size = "3"
      8longtype = "number" size = "4"
      sString, 0-255 charstype = "string"
      SString, 0-2^32-1 charstype = "longstr"
      bbyte[], 0-2^32-1 bytestype = "chunk"
      cbyte[], 0-2^32-1 bytestype = "chunk"
      fZFrametype = "frame"
      mZMsgtype = "msg" Has to be the last element of the picture
      args - Arguments according to the picture
      Returns:
      true when it has been queued on the socket and ØMQ has assumed responsibility for the message. This does not indicate that the message has been transmitted to the network.
      API Note
      Does not change or take ownership of any arguments.
    • sendBinaryPicture

      public boolean sendBinaryPicture(ZMQ.Socket socket, String picture, Object... args)
    • recvBinaryPicture

      public Object[] recvBinaryPicture(ZMQ.Socket socket, String picture)
      Receive a binary encoded 'picture' message from the socket (or actor). This method is similar to ZMQ.Socket.recv(), except the arguments are encoded in a binary format that is compatible with zproto, and is designed to reduce memory allocations.
      Parameters:
      picture - The picture argument is a string that defines the type of each argument. See sendBinaryPicture(Socket, String, Object...) for the supported argument types.
      Returns:
      the picture elements as object array
    • sendPicture

      public boolean sendPicture(ZMQ.Socket socket, String picture, Object... args)
      Queues a 'picture' message to the socket (or actor), so it can be sent.
      Parameters:
      picture - The picture is a string that defines the type of each frame. This makes it easy to send a complex multiframe message in one call. The picture can contain any of these characters, each corresponding to zero or one arguments:

      Types of arguments
      i = int (stores signed integer)
      1 = byte (stores 8-bit unsigned integer)
      2 = int (stores 16-bit unsigned integer)
      4 = long (stores 32-bit unsigned integer)
      8 = long (stores 64-bit unsigned integer)
      s = String
      b = byte[]
      c = byte[]
      f = ZFrame
      m = ZMsg (sends all frames in the ZMsg)Has to be the last element of the picture
      z = sends zero-sized frame (0 arguments)
      Note that s, b, f and m are encoded the same way and the choice is offered as a convenience to the sender, which may or may not already have data in a ZFrame or ZMsg. Does not change or take ownership of any arguments. Also see recvPicture(Socket, String)} how to recv a multiframe picture.
      args - Arguments according to the picture
      Returns:
      true if successful, false if sending failed for any reason
    • recvPicture

      public Object[] recvPicture(ZMQ.Socket socket, String picture)
      Receive a 'picture' message to the socket (or actor).
      Parameters:
      picture - The picture is a string that defines the type of each frame. This makes it easy to recv a complex multiframe message in one call. The picture can contain any of these characters, each corresponding to zero or one elements in the result:

      Types of arguments
      i = int (stores signed integer)
      1 = int (stores 8-bit unsigned integer)
      2 = int (stores 16-bit unsigned integer)
      4 = long (stores 32-bit unsigned integer)
      8 = long (stores 64-bit unsigned integer)
      s = String
      b = byte[]
      f = ZFrame (creates zframe)
      m = ZMsg (creates a zmsg with the remaing frames)
      z = null, asserts empty frame (0 arguments)
      Also see sendPicture(Socket, String, Object...) how to send a multiframe picture.
      Returns:
      the picture elements as object array