Package org.zeromq.proto
Class ZPicture
- java.lang.Object
-
- org.zeromq.proto.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.
-
-
-
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 pattern java type zproto type 1 int type = "number" size = "1" 2 int type = "number" size = "2" 4 long type = "number" size = "3" 8 long type = "number" size = "4" s String, 0-255 chars type = "string" S String, 0-2^32-1 chars type = "longstr" b byte[], 0-2^32-1 bytes type = "chunk" c byte[], 0-2^32-1 bytes type = "chunk" f ZFrame type = "frame" m ZMsg type = "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 toZMQ.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. SeesendBinaryPicture(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) 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) sendPicture(Socket, String, Object...)
how to send a multiframe picture.- Returns:
- the picture elements as object array
-
-