Class ZPicture


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

      Fields 
      Modifier and Type Field Description
      private static java.util.regex.Pattern BINARY_FORMAT  
      private static java.util.regex.Pattern FORMAT  
    • Constructor Summary

      Constructors 
      Constructor Description
      ZPicture()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ZMsg msgBinaryPicture​(java.lang.String picture, java.lang.Object... args)
      Creates a binary encoded 'picture' message to the socket (or actor), so it can be sent.
      java.lang.Object[] recvBinaryPicture​(ZMQ.Socket socket, java.lang.String picture)
      Receive a binary encoded 'picture' message from the socket (or actor).
      java.lang.Object[] recvPicture​(ZMQ.Socket socket, java.lang.String picture)
      Receive a 'picture' message to the socket (or actor).
      boolean sendBinaryPicture​(ZMQ.Socket socket, java.lang.String picture, java.lang.Object... args)  
      boolean sendPicture​(ZMQ.Socket socket, java.lang.String picture, java.lang.Object... args)
      Queues a 'picture' message to the socket (or actor), so it can be sent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FORMAT

        private static final java.util.regex.Pattern FORMAT
      • BINARY_FORMAT

        private static final java.util.regex.Pattern BINARY_FORMAT
    • Constructor Detail

      • ZPicture

        public ZPicture()
    • Method Detail

      • msgBinaryPicture

        public ZMsg msgBinaryPicture​(java.lang.String picture,
                                     java.lang.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.
      • sendBinaryPicture

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

        public java.lang.Object[] recvBinaryPicture​(ZMQ.Socket socket,
                                                    java.lang.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,
                                   java.lang.String picture,
                                   java.lang.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 java.lang.Object[] recvPicture​(ZMQ.Socket socket,
                                              java.lang.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