public class Message extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Message.ArgumentType
Defines constants for each argument type.
|
static interface |
Message.Endian
Defines constants representing the endianness of the message.
|
static interface |
Message.Flags
Defines constants representing the flags which can be set on a message.
|
static interface |
Message.HeaderField
Defines constants for each valid header field type.
|
static interface |
Message.MessageType
Defines constants for each message type.
|
| Modifier and Type | Field and Description |
|---|---|
protected static long |
globalserial |
static int |
MAXIMUM_ARRAY_LENGTH |
static int |
MAXIMUM_MESSAGE_LENGTH |
static int |
MAXIMUM_NUM_UNIX_FDS |
static byte |
PROTOCOL
The current protocol major version.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Message()
Create a blank message.
|
protected |
Message(byte endian,
byte _type,
byte _flags)
Create a message; only to be called by sub-classes.
|
| Modifier and Type | Method and Description |
|---|---|
int |
align(int _current,
byte _type)
Align a counter to the given type.
|
void |
append(String sig,
Object... data)
Append a series of values to the message.
|
protected void |
appendByte(byte b)
Appends a byte to the buffer list.
|
protected void |
appendBytes(byte[] buf)
Appends a buffer to the buffer list.
|
void |
appendint(long l,
int width)
Marshalls an integer of a given width and appends it to the message.
|
static long |
demarshallint(byte[] buf,
int ofs,
byte endian,
int width)
Demarshalls an integer of a given width from a buffer.
|
long |
demarshallint(byte[] buf,
int ofs,
int width)
Demarshalls an integer of a given width from a buffer.
|
static long |
demarshallintBig(byte[] buf,
int ofs,
int width)
Demarshalls an integer of a given width from a buffer using big-endian format.
|
static long |
demarshallintLittle(byte[] buf,
int ofs,
int width)
Demarshalls an integer of a given width from a buffer using little-endian format.
|
Object[] |
extract(String _signature,
byte[] _dataBuf,
int _offsets)
Demarshall values from a buffer.
|
Object[] |
extract(String _signature,
byte[] _dataBuf,
int[] _offsets)
Demarshall values from a buffer.
|
static int |
getAlignment(byte type)
Return the alignment for a given type.
|
protected long |
getByteCounter() |
String |
getDestination()
Returns the destination of the message.
|
byte |
getEndianess() |
List<FileDescriptor> |
getFiledescriptors() |
int |
getFlags()
Returns the message flags.
|
Object |
getHeader(byte _type)
Returns the value of the header field of a given field.
|
static String |
getHeaderFieldName(byte field)
Returns the name of the given header field.
|
protected Map<Byte,Object> |
getHeaders() |
String |
getInterface()
Returns the interface of the message.
|
String |
getName()
Returns the member name or error name this message represents.
|
Object[] |
getParameters()
Parses and returns the parameters to this message as an Object array.
|
String |
getPath()
Returns the object path of the message.
|
long |
getReplySerial()
If this is a reply to a message, this returns its serial.
|
long |
getSerial()
Returns the message serial ID (unique for this connection)
|
String |
getSig()
Returns the dbus signature of the parameters.
|
String |
getSource()
Returns the Bus ID that sent the message.
|
byte |
getType()
Type of this message.
|
protected byte[][] |
getWiredata() |
byte[][] |
getWireData() |
void |
marshallint(long l,
byte[] buf,
int ofs,
int width)
Marshalls an integer of a given width into a buffer.
|
static void |
marshallintBig(long l,
byte[] buf,
int ofs,
int width)
Marshalls an integer of a given width into a buffer using big-endian format.
|
static void |
marshallintLittle(long l,
byte[] buf,
int ofs,
int width)
Marshalls an integer of a given width into a buffer using little-endian format.
|
void |
pad(byte _type)
Pad the message to the proper alignment for the given type.
|
void |
setArgs(Object[] _args) |
protected void |
setByteCounter(long _bytecounter) |
protected void |
setSerial(long _serial) |
void |
setSource(String source)
Warning, do not use this method unless you really know what you are doing.
|
protected void |
setWiredata(byte[][] _wiredata) |
String |
toString()
Formats the message in a human-readable format.
|
public static final int MAXIMUM_ARRAY_LENGTH
public static final int MAXIMUM_MESSAGE_LENGTH
public static final int MAXIMUM_NUM_UNIX_FDS
public static final byte PROTOCOL
protected static long globalserial
protected Message(byte endian,
byte _type,
byte _flags)
throws DBusException
endian - The endianness to create the message._type - The message type._flags - Any message flags.DBusException - on errorprotected Message()
public static String getHeaderFieldName(byte field)
field - fieldprotected long getByteCounter()
protected void setByteCounter(long _bytecounter)
protected void setSerial(long _serial)
protected byte[][] getWiredata()
protected void setWiredata(byte[][] _wiredata)
protected void appendBytes(byte[] buf)
buf - buffer byte arrayprotected void appendByte(byte b)
b - bytepublic long demarshallint(byte[] buf,
int ofs,
int width)
buf - The buffer to demarshall from.ofs - The offset to demarshall from.width - The byte-width of the int.public static long demarshallint(byte[] buf,
int ofs,
byte endian,
int width)
buf - The buffer to demarshall from.ofs - The offset to demarshall from.endian - The endianness to use in demarshalling.width - The byte-width of the int.public static long demarshallintBig(byte[] buf,
int ofs,
int width)
buf - The buffer to demarshall from.ofs - The offset to demarshall from.width - The byte-width of the int.public static long demarshallintLittle(byte[] buf,
int ofs,
int width)
buf - The buffer to demarshall from.ofs - The offset to demarshall from.width - The byte-width of the int.public void appendint(long l,
int width)
l - The integer to marshall.width - The byte-width of the int.public void marshallint(long l,
byte[] buf,
int ofs,
int width)
l - The integer to marshall.buf - The buffer to marshall to.ofs - The offset to marshall to.width - The byte-width of the int.public static void marshallintBig(long l,
byte[] buf,
int ofs,
int width)
l - The integer to marshall.buf - The buffer to marshall to.ofs - The offset to marshall to.width - The byte-width of the int.public static void marshallintLittle(long l,
byte[] buf,
int ofs,
int width)
l - The integer to marshall.buf - The buffer to demarshall to.ofs - The offset to demarshall to.width - The byte-width of the int.public byte[][] getWireData()
public List<FileDescriptor> getFiledescriptors()
public String toString()
public Object getHeader(byte _type)
_type - The field to return.public void pad(byte _type)
_type - typepublic static int getAlignment(byte type)
type - typepublic void append(String sig, Object... data) throws DBusException
sig - The signature(s) of the value(s).data - The value(s).DBusException - on errorpublic int align(int _current,
byte _type)
_current - The current counter._type - The type to align to.public Object[] extract(String _signature, byte[] _dataBuf, int _offsets) throws DBusException
_signature - The D-Bus signature(s) of the value(s)._dataBuf - The buffer to demarshall from._offsets - The offset into the data buffer to start.DBusException - on errorpublic Object[] extract(String _signature, byte[] _dataBuf, int[] _offsets) throws DBusException
_signature - The D-Bus signature(s) of the value(s)._dataBuf - The buffer to demarshall from._offsets - An array of two ints, which holds the position of the current signature offset and the current
offset of the data buffer. These values will be updated to the start of the next value after
demarshalling.DBusException - on errorpublic String getSource()
public String getDestination()
public String getInterface()
public String getPath()
public String getName()
public String getSig()
public int getFlags()
public long getSerial()
public long getReplySerial()
public Object[] getParameters() throws DBusException
DBusException - on failurepublic void setArgs(Object[] _args)
public void setSource(String source) throws DBusException
source - stringDBusException - on errorpublic byte getType()
public byte getEndianess()
Copyright © 2020. All rights reserved.