Class Msg
java.lang.Object
zmq.Msg
- Direct Known Subclasses:
Msg.Builder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBufferstatic final intstatic final intprivate SocketChannelprivate intprivate Stringstatic final intstatic final intThe maximum length of a group (Radio/Dish)private Metadatastatic final intprivate intprivate intstatic final intprivate final intprivate Msg.Typeprivate int -
Constructor Summary
ConstructorsModifierConstructorDescriptionMsg()Msg(byte[] src) Msg(int capacity) Msg(ByteBuffer src) privateMsg(Msg src, ByteArrayOutputStream out) -
Method Summary
Modifier and TypeMethodDescriptionbuf()booleancheck()byte[]data()Returns the message data.fd()intflags()byteget()byteget(int index) intgetBytes(int index, byte[] dst, int off, int len) intgetBytes(int index, ByteBuffer bb, int len) getGroup()Retrieve the group for RADIO/DISH socketsintgetInt(int offset) longgetLong(int offset) intReturn the routing id of a message.intgetShort(int offset) protected final intbooleanhasMore()voidvoidinitJoin()voidbooleanbooleanbooleanbooleanbooleanisJoin()booleanisLeave()put(byte b) put(byte[] src) put(byte[] src, int off, int len) put(int b) protected Msgput(int index, byte b) put(ByteBuffer src) put(ByteBuffer src, int off, int len) putShortString(String data) Puts a string into the message, prefixed with its length.voidresetFlags(int f) voidvoidvoidsetFd(SocketChannel fileDesc) voidsetFlags(int flags) booleanSet the group for RADIO/DISH socketssetMetadata(Metadata metadata) booleansetRoutingId(int routingId) Set the routing id on a message.protected final voidsetWriteIndex(int writeIndex) intsize()toString()voidtransfer(ByteBuffer destination, int srcOffset, int srcLength)
-
Field Details
-
MORE
public static final int MORE- See Also:
-
COMMAND
public static final int COMMAND- See Also:
-
CREDENTIAL
public static final int CREDENTIAL- See Also:
-
IDENTITY
public static final int IDENTITY- See Also:
-
SHARED
public static final int SHARED- See Also:
-
MAX_GROUP_LENGTH
public static final int MAX_GROUP_LENGTHThe maximum length of a group (Radio/Dish)- See Also:
-
metadata
-
flags
private int flags -
type
-
fileDesc
-
size
private final int size -
buf
-
writeIndex
private int writeIndex -
readIndex
private int readIndex -
routingId
private int routingId -
group
-
-
Constructor Details
-
Msg
public Msg() -
Msg
public Msg(int capacity) -
Msg
public Msg(byte[] src) -
Msg
-
Msg
-
Msg
-
-
Method Details
-
isIdentity
public boolean isIdentity() -
isDelimiter
public boolean isDelimiter() -
isJoin
public boolean isJoin() -
isLeave
public boolean isLeave() -
check
public boolean check() -
flags
public int flags() -
hasMore
public boolean hasMore() -
isCommand
public boolean isCommand() -
isCredential
public boolean isCredential() -
setFlags
public void setFlags(int flags) -
initDelimiter
public void initDelimiter() -
initJoin
public void initJoin() -
initLeave
public void initLeave() -
data
public byte[] data()Returns the message data. If possible, a reference to the data is returned, without copy. Otherwise a new byte array will be allocated and the data will be copied.- Returns:
- the message data.
-
buf
-
size
public int size() -
resetFlags
public void resetFlags(int f) -
setFd
-
fd
-
getMetadata
-
setMetadata
-
resetMetadata
public void resetMetadata() -
get
public byte get() -
get
public byte get(int index) -
put
-
put
-
put
-
put
-
put
-
put
-
put
-
getBytes
public int getBytes(int index, byte[] dst, int off, int len) -
getBytes
-
toString
-
getWriteIndex
protected final int getWriteIndex() -
setWriteIndex
protected final void setWriteIndex(int writeIndex) -
getLong
public long getLong(int offset) -
getInt
public int getInt(int offset) -
getShort
public int getShort(int offset) -
transfer
-
putShortString
Puts a string into the message, prefixed with its length. Users shall size the message by adding 1 to the length of the string: It needs to be able to accommodate (data.length+1) more bytes.- Parameters:
data- a string shorter than 256 characters. If null, defaults to a no-op.- Returns:
- the same message.
-
getRoutingId
public int getRoutingId()Return the routing id of a message. The routing id represent the CLIENT socket that sent the message to the SERVER socket.- Returns:
- the routing id
-
setRoutingId
public boolean setRoutingId(int routingId) Set the routing id on a message. The routing id represent the CLIENT socket which the message should be sent to. Only SERVER socket is currently using the routing id.- Parameters:
routingId- the routing id- Returns:
- true if successfully set the routing id.
-
getGroup
-
setGroup
Set the group for RADIO/DISH sockets- Parameters:
group-- Returns:
- true if successfully set the group.
-
resetRoutingId
public void resetRoutingId()
-