public class Msg
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Msg.Builder |
(package private) static class |
Msg.Type |
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
buf |
static int |
COMMAND |
static int |
CREDENTIAL |
private java.nio.channels.SocketChannel |
fileDesc |
private int |
flags |
private java.lang.String |
group |
static int |
IDENTITY |
static int |
MAX_GROUP_LENGTH |
private Metadata |
metadata |
static int |
MORE |
private int |
readIndex |
private int |
routingId |
static int |
SHARED |
private int |
size |
private Msg.Type |
type |
private int |
writeIndex |
Modifier | Constructor and Description |
---|---|
|
Msg() |
|
Msg(byte[] src) |
|
Msg(java.nio.ByteBuffer src) |
|
Msg(int capacity) |
|
Msg(Msg m) |
private |
Msg(Msg src,
java.io.ByteArrayOutputStream out) |
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
buf() |
boolean |
check() |
byte[] |
data()
Returns the message data.
|
java.nio.channels.SocketChannel |
fd() |
int |
flags() |
byte |
get() |
byte |
get(int index) |
int |
getBytes(int index,
byte[] dst,
int off,
int len) |
int |
getBytes(int index,
java.nio.ByteBuffer bb,
int len) |
java.lang.String |
getGroup()
Retrieve the group for RADIO/DISH sockets
|
int |
getInt(int offset) |
long |
getLong(int offset) |
Metadata |
getMetadata() |
int |
getRoutingId()
Return the routing id of a message.
|
int |
getShort(int offset) |
protected int |
getWriteIndex() |
boolean |
hasMore() |
void |
initDelimiter() |
void |
initJoin() |
void |
initLeave() |
boolean |
isCommand() |
boolean |
isCredential() |
boolean |
isDelimiter() |
boolean |
isIdentity() |
boolean |
isJoin() |
boolean |
isLeave() |
Msg |
put(byte b) |
Msg |
put(byte[] src) |
Msg |
put(byte[] src,
int off,
int len) |
Msg |
put(java.nio.ByteBuffer src) |
Msg |
put(java.nio.ByteBuffer src,
int off,
int len) |
Msg |
put(int b) |
protected Msg |
put(int index,
byte b) |
Msg |
putShortString(java.lang.String data)
Puts a string into the message, prefixed with its length.
|
void |
resetFlags(int f) |
void |
resetMetadata() |
void |
resetRoutingId() |
void |
setFd(java.nio.channels.SocketChannel fileDesc) |
void |
setFlags(int flags) |
boolean |
setGroup(java.lang.String group)
Set the group for RADIO/DISH sockets
|
Msg |
setMetadata(Metadata metadata) |
boolean |
setRoutingId(int routingId)
Set the routing id on a message.
|
protected void |
setWriteIndex(int writeIndex) |
int |
size() |
java.lang.String |
toString() |
void |
transfer(java.nio.ByteBuffer destination,
int srcOffset,
int srcLength) |
public static final int MORE
public static final int COMMAND
public static final int CREDENTIAL
public static final int IDENTITY
public static final int SHARED
public static final int MAX_GROUP_LENGTH
private Metadata metadata
private int flags
private Msg.Type type
private java.nio.channels.SocketChannel fileDesc
private final int size
private final java.nio.ByteBuffer buf
private int writeIndex
private int readIndex
private int routingId
private java.lang.String group
public Msg()
public Msg(int capacity)
public Msg(byte[] src)
public Msg(java.nio.ByteBuffer src)
public Msg(Msg m)
private Msg(Msg src, java.io.ByteArrayOutputStream out)
public boolean isIdentity()
public boolean isDelimiter()
public boolean isJoin()
public boolean isLeave()
public boolean check()
public int flags()
public boolean hasMore()
public boolean isCommand()
public boolean isCredential()
public void setFlags(int flags)
public void initDelimiter()
public void initJoin()
public void initLeave()
public byte[] data()
public java.nio.ByteBuffer buf()
public int size()
public void resetFlags(int f)
public void setFd(java.nio.channels.SocketChannel fileDesc)
public java.nio.channels.SocketChannel fd()
public Metadata getMetadata()
public void resetMetadata()
public byte get()
public byte get(int index)
public Msg put(byte b)
public Msg put(int b)
protected Msg put(int index, byte b)
public Msg put(byte[] src)
public Msg put(byte[] src, int off, int len)
public Msg put(java.nio.ByteBuffer src, int off, int len)
public Msg put(java.nio.ByteBuffer src)
public int getBytes(int index, byte[] dst, int off, int len)
public int getBytes(int index, java.nio.ByteBuffer bb, int len)
public java.lang.String toString()
toString
in class java.lang.Object
protected final int getWriteIndex()
protected final void setWriteIndex(int writeIndex)
public long getLong(int offset)
public int getInt(int offset)
public int getShort(int offset)
public void transfer(java.nio.ByteBuffer destination, int srcOffset, int srcLength)
public Msg putShortString(java.lang.String data)
data
- a string shorter than 256 characters. If null, defaults to a no-op.public int getRoutingId()
public boolean setRoutingId(int routingId)
routingId
- the routing idpublic java.lang.String getGroup()
public boolean setGroup(java.lang.String group)
group
- public void resetRoutingId()