public class ZFrame extends Object
Modifier and Type | Field | Description |
---|---|---|
static int |
DONTWAIT |
|
static int |
MORE |
|
static int |
REUSE |
Modifier | Constructor | Description |
---|---|---|
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
|
Modifier and Type | Method | Description |
---|---|---|
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
|
public static final int MORE
public static final int REUSE
public static final int DONTWAIT
protected ZFrame()
public ZFrame(byte[] data)
data
- Data to copy into ZFrame objectpublic ZFrame(String data)
data
- 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 classpublic boolean sendAndKeep(ZMQ.Socket socket, int flags)
socket
- 0MQ socket to send frameflags
- Valid send() method flags, defined in org.zeromq.ZMQ classpublic boolean sendAndKeep(ZMQ.Socket socket)
socket
- 0MQ socket to send framepublic boolean sendAndDestroy(ZMQ.Socket socket, int flags)
socket
- 0MQ socket to send frameflags
- Valid send() method flags, defined in org.zeromq.ZMQ classpublic boolean sendAndDestroy(ZMQ.Socket socket)
socket
- 0MQ socket to send framepublic ZFrame duplicate()
public boolean hasSameData(ZFrame other)
other
- The other ZFrame to comparepublic 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 datapublic String toString()
public static ZFrame recvFrame(ZMQ.Socket socket)
socket
- Socket to read frompublic static ZFrame recvFrame(ZMQ.Socket socket, int flags)
socket
- Socket to read fromflags
- Pass flags to 0MQ socket.recv callpublic void print(String prefix)