|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zeromq.ZFrame
public class ZFrame
ZFrame The ZFrame class provides methods to send and receive single message frames across 0MQ sockets. A 'frame' corresponds to one underlying zmq_msg_t in the libzmq code. When you read a frame from a socket, the more() method indicates if the frame is part of an unfinished multipart message. The send() method normally destroys the frame, but with the ZFRAME_REUSE flag, you can send the same frame many times. Frames are binary, and this class has no special support for text data. Based on zframe.c in czmq
Field Summary | |
---|---|
static int |
DONTWAIT
|
static int |
MORE
|
static int |
REUSE
|
Constructor Summary | |
---|---|
protected |
ZFrame()
Class Constructor Creates an empty frame. |
|
ZFrame(byte[] data)
Class Constructor Copies message data into ZFrame object |
|
ZFrame(String data)
Class Constructor Copies String into frame data |
Method Summary | |
---|---|
void |
destroy()
Destructor. |
ZFrame |
duplicate()
Creates a new frame that duplicates an existing frame |
boolean |
equals(Object o)
|
byte[] |
getData()
|
boolean |
hasData()
Convenience method to ascertain if this frame contains some message data |
int |
hashCode()
|
boolean |
hasMore()
|
boolean |
hasSameData(ZFrame other)
Returns true if both frames have byte - for byte identical data |
void |
print(String prefix)
|
static ZFrame |
recvFrame(ZMQ.Socket socket)
Receives single frame from socket, returns the received frame object, or null if the recv was interrupted. |
static ZFrame |
recvFrame(ZMQ.Socket socket,
int flags)
Receive a new frame off the socket, Returns newly-allocated frame, or null if there was no input waiting, or if the read was interrupted. |
void |
reset(byte[] data)
Sets new contents for frame |
void |
reset(String data)
Sets new contents for frame |
boolean |
send(ZMQ.Socket socket,
int flags)
Method to call org.zeromq.Socket send() method. |
boolean |
sendAndDestroy(ZMQ.Socket socket)
Sends frame to socket if it contains data. |
boolean |
sendAndDestroy(ZMQ.Socket socket,
int flags)
Sends frame to socket if it contains data. |
boolean |
sendAndKeep(ZMQ.Socket socket)
Sends frame to socket if it contains any data. |
boolean |
sendAndKeep(ZMQ.Socket socket,
int flags)
Sends frame to socket if it contains any data. |
int |
size()
Returns byte size of frame, if set, else 0 |
boolean |
streq(String str)
String equals. |
String |
strhex()
Returns frame data as a printable hex string |
String |
toString()
Returns a human - readable representation of frame's data |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MORE
public static final int REUSE
public static final int DONTWAIT
Constructor Detail |
---|
protected ZFrame()
public ZFrame(byte[] data)
data
- Data to copy into ZFrame objectpublic ZFrame(String data)
data
- Method Detail |
---|
public void destroy()
public byte[] getData()
public boolean hasMore()
public int size()
public boolean hasData()
public boolean send(ZMQ.Socket socket, int flags)
socket
- 0MQ socket to send onflags
- Valid send() method flags, defined in org.zeromq.ZMQ class
public boolean sendAndKeep(ZMQ.Socket socket, int flags)
socket
- 0MQ socket to send frameflags
- Valid send() method flags, defined in org.zeromq.ZMQ class
public boolean sendAndKeep(ZMQ.Socket socket)
socket
- 0MQ socket to send frame
public boolean sendAndDestroy(ZMQ.Socket socket, int flags)
socket
- 0MQ socket to send frameflags
- Valid send() method flags, defined in org.zeromq.ZMQ class
public boolean sendAndDestroy(ZMQ.Socket socket)
socket
- 0MQ socket to send frame
public ZFrame duplicate()
public boolean hasSameData(ZFrame other)
other
- The other ZFrame to compare
public void reset(byte[] data)
data
- New byte array contents for framepublic void reset(String data)
data
- String contents for framepublic String strhex()
public boolean streq(String str)
str
- String to compare with frame data
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public static ZFrame recvFrame(ZMQ.Socket socket)
socket
- Socket to read from
public static ZFrame recvFrame(ZMQ.Socket socket, int flags)
socket
- Socket to read fromflags
- Pass flags to 0MQ socket.recv call
public void print(String prefix)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |