java.lang.Object
org.freedesktop.dbus.messages.Message
- Bekannte direkte Unterklassen:
DBusSignal
,Error
,MethodBase
Superclass of all messages which are sent over the Bus.
This class deals with all the marshalling to/from the wire format.
This class deals with all the marshalling to/from the wire format.
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprotected final org.slf4j.Logger
static final int
static final int
static final int
static final byte
The current protocol major version. -
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected int
align
(int _current, byte _type) Align a counter to the given type.protected void
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.protected void
appendint
(long _l, int _width) Marshalls an integer of a given width and appends it to the message.protected Object[]
createHeaderArgs
(byte _header, String _argType, Object _value) Creates a message header.static long
demarshallint
(byte[] _buf, int _ofs, byte _endian, int _width) Demarshalls an integer of a given width from a buffer.protected 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.protected Object[]
extract
(String _signature, byte[] _dataBuf, int[] _offsets, org.freedesktop.dbus.messages.Message.ExtractOptions _options) Demarshall values from a buffer.protected Object[]
extract
(String _signature, byte[] _dataBuf, int _offsets, org.freedesktop.dbus.messages.Message.ExtractOptions _options) Demarshall values from a buffer.static int
getAlignment
(byte _type) Return the alignment for a given type.protected long
Returns the destination of the message.byte
int
getFlags()
Returns the message flags.protected Object[]
protected 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.Returns the interface of the message.getName()
Returns the member name or error name this message represents.Object[]
Parses and returns the parameters to this message as an Object array.getPath()
Returns the object path of the message.long
If this is a reply to a message, this returns its serial.long
Returns the message serial ID (unique for this connection)getSig()
Returns the dbus signature of the parameters.Returns the Bus ID that sent the message.byte
getType()
Type of this message.byte[][]
protected 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.protected void
pad
(byte _type) Pad the message to the proper alignment for the given type.protected void
padAndMarshall
(List<Object> _hargs, long _serial, String _sig, Object... _args) Adds message padding and marshalling.void
protected void
setByteCounter
(long _bytecounter) protected void
Set header content.protected void
setSerial
(long _serial) void
Warning, do not use this method unless you really know what you are doing.protected void
setWireData
(byte[][] _wiredata) toString()
Formats the message in a human-readable format.void
updateEndianess
(byte _endianess)
-
Felddetails
-
MAXIMUM_ARRAY_LENGTH
public static final int MAXIMUM_ARRAY_LENGTH- Siehe auch:
-
MAXIMUM_MESSAGE_LENGTH
public static final int MAXIMUM_MESSAGE_LENGTH- Siehe auch:
-
MAXIMUM_NUM_UNIX_FDS
public static final int MAXIMUM_NUM_UNIX_FDS- Siehe auch:
-
PROTOCOL
public static final byte PROTOCOLThe current protocol major version.- Siehe auch:
-
logger
protected final org.slf4j.Logger logger
-
-
Konstruktordetails
-
Message
Create a message; only to be called by sub-classes.- Parameter:
_endian
- The endianness to create the message._type
- The message type._flags
- Any message flags.- Löst aus:
DBusException
- on error
-
Message
protected Message()Create a blank message. Only to be used when calling populate.
-
-
Methodendetails
-
updateEndianess
public void updateEndianess(byte _endianess) -
getHeader
-
setHeader
Set header content.null
value is ignored.- Parameter:
_header
- header to set
-
getByteCounter
protected long getByteCounter() -
setByteCounter
protected void setByteCounter(long _bytecounter) -
setSerial
protected void setSerial(long _serial) -
setWireData
protected void setWireData(byte[][] _wiredata) -
appendBytes
protected void appendBytes(byte[] _buf) Appends a buffer to the buffer list.- Parameter:
_buf
- buffer byte array
-
appendByte
protected void appendByte(byte _b) Appends a byte to the buffer list.- Parameter:
_b
- byte
-
demarshallint
protected long demarshallint(byte[] _buf, int _ofs, int _width) Demarshalls an integer of a given width from a buffer. Endianness is determined from the format of the message.- Parameter:
_buf
- The buffer to demarshall from._ofs
- The offset to demarshall from._width
- The byte-width of the int.- Gibt zurück:
- long
-
appendint
protected void appendint(long _l, int _width) Marshalls an integer of a given width and appends it to the message. Endianness is determined from the message.- Parameter:
_l
- The integer to marshall._width
- The byte-width of the int.
-
marshallint
protected void marshallint(long _l, byte[] _buf, int _ofs, int _width) Marshalls an integer of a given width into a buffer. Endianness is determined from the message.- Parameter:
_l
- The integer to marshall._buf
- The buffer to marshall to._ofs
- The offset to marshall to._width
- The byte-width of the int.
-
getWireData
public byte[][] getWireData() -
getFiledescriptors
-
toString
Formats the message in a human-readable format. -
getHeader
Returns the value of the header field of a given field.- Parameter:
_type
- The field to return.- Gibt zurück:
- The value of the field or null if unset.
-
pad
protected void pad(byte _type) Pad the message to the proper alignment for the given type.- Parameter:
_type
- type
-
append
Append a series of values to the message.- Parameter:
_sig
- The signature(s) of the value(s)._data
- The value(s).- Löst aus:
DBusException
- on error
-
align
protected int align(int _current, byte _type) Align a counter to the given type.- Parameter:
_current
- The current counter._type
- The type to align to.- Gibt zurück:
- The new, aligned, counter.
-
extract
protected Object[] extract(String _signature, byte[] _dataBuf, int _offsets, org.freedesktop.dbus.messages.Message.ExtractOptions _options) throws DBusException Demarshall values from a buffer.- Parameter:
_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._options
- additional options- Gibt zurück:
- The demarshalled value(s).
- Löst aus:
DBusException
- on error
-
extract
protected Object[] extract(String _signature, byte[] _dataBuf, int[] _offsets, org.freedesktop.dbus.messages.Message.ExtractOptions _options) throws DBusException Demarshall values from a buffer.- Parameter:
_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._options
- additional options- Gibt zurück:
- The demarshalled value(s).
- Löst aus:
DBusException
- on error
-
getSource
Returns the Bus ID that sent the message.- Gibt zurück:
- string
-
getDestination
Returns the destination of the message.- Gibt zurück:
- string
-
getInterface
Returns the interface of the message.- Gibt zurück:
- string
-
getPath
Returns the object path of the message.- Gibt zurück:
- string
-
getName
Returns the member name or error name this message represents.- Gibt zurück:
- string
-
getSig
Returns the dbus signature of the parameters.- Gibt zurück:
- string
-
getFlags
public int getFlags()Returns the message flags.- Gibt zurück:
- int
-
getSerial
public long getSerial()Returns the message serial ID (unique for this connection)- Gibt zurück:
- the message serial.
-
getReplySerial
public long getReplySerial()If this is a reply to a message, this returns its serial.- Gibt zurück:
- The reply serial, or 0 if it is not a reply.
-
getParameters
Parses and returns the parameters to this message as an Object array.- Gibt zurück:
- object array
- Löst aus:
DBusException
- on failure
-
setArgs
-
setSource
Warning, do not use this method unless you really know what you are doing.- Parameter:
_source
- string- Löst aus:
DBusException
- on error
-
getType
public byte getType()Type of this message.- Gibt zurück:
- byte
-
getEndianess
public byte getEndianess() -
createHeaderArgs
Creates a message header. Will automatically add the values to the current instances header map.- Parameter:
_header
- header type (one ofHeaderField
)_argType
- argument type (one ofArgumentType
)_value
- value- Gibt zurück:
- Object array
-
padAndMarshall
protected void padAndMarshall(List<Object> _hargs, long _serial, String _sig, Object... _args) throws DBusException Adds message padding and marshalling.- Parameter:
_hargs
-_serial
-_sig
-_args
-- Löst aus:
DBusException
-
demarshallint
public static long demarshallint(byte[] _buf, int _ofs, byte _endian, int _width) Demarshalls an integer of a given width from a buffer.- Parameter:
_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.- Gibt zurück:
- long
-
demarshallintBig
public static long demarshallintBig(byte[] _buf, int _ofs, int _width) Demarshalls an integer of a given width from a buffer using big-endian format.- Parameter:
_buf
- The buffer to demarshall from._ofs
- The offset to demarshall from._width
- The byte-width of the int.- Gibt zurück:
- long
-
demarshallintLittle
public static long demarshallintLittle(byte[] _buf, int _ofs, int _width) Demarshalls an integer of a given width from a buffer using little-endian format.- Parameter:
_buf
- The buffer to demarshall from._ofs
- The offset to demarshall from._width
- The byte-width of the int.- Gibt zurück:
- long
-
marshallintBig
public 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.- Parameter:
_l
- The integer to marshall._buf
- The buffer to marshall to._ofs
- The offset to marshall to._width
- The byte-width of the int.
-
marshallintLittle
public 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.- Parameter:
_l
- The integer to marshall._buf
- The buffer to demarshall to._ofs
- The offset to demarshall to._width
- The byte-width of the int.
-
getAlignment
public static int getAlignment(byte _type) Return the alignment for a given type.- Parameter:
_type
- type- Gibt zurück:
- int
-
getHeaderFieldName
Returns the name of the given header field.- Parameter:
_field
- field- Gibt zurück:
- string
-