Package zmq
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 ByteBuffer
static final int
static final int
private SocketChannel
private int
static final int
private Metadata
static final int
private int
static final int
private final int
private Msg.Type
private int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionMsg()
Msg
(byte[] src) Msg
(int capacity) Msg
(ByteBuffer src) private
Msg
(Msg src, ByteArrayOutputStream out) -
Method Summary
Modifier and TypeMethodDescriptionbuf()
boolean
check()
byte[]
data()
Returns the message data.fd()
int
flags()
byte
get()
byte
get
(int index) int
getBytes
(int index, byte[] dst, int off, int len) int
getBytes
(int index, ByteBuffer bb, int len) int
getInt
(int offset) long
getLong
(int offset) int
getShort
(int offset) protected final int
boolean
hasMore()
void
boolean
boolean
boolean
boolean
put
(byte b) put
(byte[] src) put
(byte[] src, int off, int len) put
(int b) protected Msg
put
(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.void
resetFlags
(int f) void
void
setFd
(SocketChannel fileDesc) void
setFlags
(int flags) setMetadata
(Metadata metadata) protected final void
setWriteIndex
(int writeIndex) int
size()
toString()
void
transfer
(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:
-
metadata
-
flags
private int flags -
type
-
fileDesc
-
size
private final int size -
buf
-
writeIndex
private int writeIndex -
readIndex
private int readIndex
-
-
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() -
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() -
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.
-