keycloak-federation
クラス | 公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 限定公開メンバ関数 | 限定公開変数類 | 静的限定公開変数類 | 関数 | 静的関数 | 非公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.freedesktop.dbus.Message クラス
org.freedesktop.dbus.Message の継承関係図
Inheritance graph
org.freedesktop.dbus.Message 連携図
Collaboration graph

クラス

interface  ArgumentType
 
interface  Endian
 
interface  Flags
 
interface  HeaderField
 
interface  MessageType
 

公開メンバ関数

long demarshallint (byte[] buf, int ofs, int width)
 
void appendint (long l, int width)
 
void marshallint (long l, byte[] buf, int ofs, int width)
 
byte [][] getWireData ()
 
String toString ()
 
Object getHeader (byte type)
 
void pad (byte type)
 
void append (String sig, Object... data) throws DBusException
 
int align (int current, byte type)
 
Object [] extract (String sig, byte[] buf, int ofs) throws DBusException
 
Object [] extract (String sig, byte[] buf, int[] ofs) throws DBusException
 
String getSource ()
 
String getDestination ()
 
String getInterface ()
 
String getPath ()
 
String getName ()
 
String getSig ()
 
int getFlags ()
 
long getSerial ()
 
long getReplySerial ()
 
Object [] getParameters () throws DBusException
 
void setSource (String source) throws DBusException
 

静的公開メンバ関数

static String getHeaderFieldName (byte field)
 
static long demarshallint (byte[] buf, int ofs, byte endian, int width)
 
static long demarshallintBig (byte[] buf, int ofs, int width)
 
static long demarshallintLittle (byte[] buf, int ofs, int width)
 
static void marshallintBig (long l, byte[] buf, int ofs, int width)
 
static void marshallintLittle (long l, byte[] buf, int ofs, int width)
 
static int getAlignment (byte type)
 

静的公開変数類

static final byte PROTOCOL = 1
 

限定公開メンバ関数

 Message (byte endian, byte type, byte flags) throws DBusException
 
 Message ()
 
void appendBytes (byte[] buf)
 
void appendByte (byte b)
 
void setArgs (Object[] args)
 

限定公開変数類

byte [][] wiredata
 
long bytecounter
 
Map< Byte, Object > headers
 
long serial
 
byte type
 
byte flags
 
byte protover
 

静的限定公開変数類

static long globalserial = 0
 

関数

void populate (byte[] msg, byte[] headers, byte[] body) throws DBusException
 

静的関数

 [static initializer]
 

非公開メンバ関数

void preallocate (int num)
 
void ensureBuffers (int num)
 
int appendone (byte[] sigb, int sigofs, Object data) throws DBusException
 
Object extractone (byte[] sigb, byte[] buf, int[] ofs, boolean contained) throws DBusException
 

非公開変数類

boolean big
 
Object [] args
 
byte [] body
 
long bodylen = 0
 
int preallocated = 0
 
int paofs = 0
 
byte [] pabuf
 
int bufferuse = 0
 

静的非公開変数類

static byte [][] padding
 
static final int BUFFERINCREMENT = 20
 

詳解

Superclass of all messages which are sent over the Bus. This class deals with all the marshalling to/from the wire format.

構築子と解体子

◆ Message() [1/2]

org.freedesktop.dbus.Message.Message ( byte  endian,
byte  type,
byte  flags 
) throws DBusException
inlineprotected

Create a message; only to be called by sub-classes.

引数
endianThe endianness to create the message.
typeThe message type.
flagsAny message flags.
205  {
206  wiredata = new byte[BUFFERINCREMENT][];
207  headers = new HashMap<Byte, Object>();
208  big = (Endian.BIG == endian);
209  bytecounter = 0;
210  synchronized (Message.class) {
211  serial = ++globalserial;
212  }
213  if (Debug.debug) Debug.print(Debug.DEBUG, "Creating message with serial " + serial);
214  this.type = type;
215  this.flags = flags;
216  preallocate(4);
217  append("yyyy", endian, type, flags, Message.PROTOCOL);
218  }
byte type
Definition: Message.java:161
byte [][] wiredata
Definition: Message.java:156
void preallocate(int num)
Definition: Message.java:262
Message()
Definition: Message.java:223
byte flags
Definition: Message.java:162
Map< Byte, Object > headers
Definition: Message.java:158
boolean big
Definition: Message.java:155
static final int BUFFERINCREMENT
Definition: Message.java:153
long bytecounter
Definition: Message.java:157
void append(String sig, Object... data)
Definition: Message.java:823
long serial
Definition: Message.java:160
static long globalserial
Definition: Message.java:159

◆ Message() [2/2]

org.freedesktop.dbus.Message.Message ( )
inlineprotected

Create a blank message. Only to be used when calling populate.

223  {
224  wiredata = new byte[BUFFERINCREMENT][];
225  headers = new HashMap<Byte, Object>();
226  bytecounter = 0;
227  }
byte [][] wiredata
Definition: Message.java:156
Map< Byte, Object > headers
Definition: Message.java:158
static final int BUFFERINCREMENT
Definition: Message.java:153
long bytecounter
Definition: Message.java:157

関数詳解

◆ [static initializer]()

org.freedesktop.dbus.Message.[static initializer] ( )
inlinestaticpackage

◆ align()

int org.freedesktop.dbus.Message.align ( int  current,
byte  type 
)
inline

Align a counter to the given type.

引数
currentThe current counter.
typeThe type to align to.
戻り値
The new, aligned, counter.
840  {
841  if (Debug.debug) Debug.print(Debug.VERBOSE, "aligning to " + (char) type);
842  int a = getAlignment(type);
843  if (0 == (current % a)) return current;
844  return current + (a - (current % a));
845  }
byte type
Definition: Message.java:161
static int getAlignment(byte type)
Definition: Message.java:782

◆ append()

void org.freedesktop.dbus.Message.append ( String  sig,
Object...  data 
) throws DBusException
inline

Append a series of values to the message.

引数
sigThe signature(s) of the value(s).
dataThe value(s).
823  {
824  if (Debug.debug) Debug.print(Debug.DEBUG, "Appending sig: " + sig + " data: " + Arrays.deepToString(data));
825  byte[] sigb = sig.getBytes();
826  int j = 0;
827  for (int i = 0; i < sigb.length; i++) {
828  if (Debug.debug) Debug.print(Debug.VERBOSE, "Appending item: " + i + " " + ((char) sigb[i]) + " " + j);
829  i = appendone(sigb, i, data[j++]);
830  }
831  }
int appendone(byte[] sigb, int sigofs, Object data)
Definition: Message.java:535

◆ appendByte()

void org.freedesktop.dbus.Message.appendByte ( byte  b)
inlineprotected

Appends a byte to the buffer list.

312  {
313  if (preallocated > 0) {
314  pabuf[paofs++] = b;
315  preallocated--;
316  } else {
317  if (bufferuse == wiredata.length) {
318  if (Debug.debug) Debug.print(Debug.VERBOSE, "Resizing " + bufferuse);
319  byte[][] temp = new byte[wiredata.length + BUFFERINCREMENT][];
320  System.arraycopy(wiredata, 0, temp, 0, wiredata.length);
321  wiredata = temp;
322  }
323  wiredata[bufferuse++] = new byte[]{b};
324  bytecounter++;
325  }
326  }
byte [][] wiredata
Definition: Message.java:156
int bufferuse
Definition: Message.java:170
int preallocated
Definition: Message.java:167
int paofs
Definition: Message.java:168
static final int BUFFERINCREMENT
Definition: Message.java:153
byte [] pabuf
Definition: Message.java:169
long bytecounter
Definition: Message.java:157

◆ appendBytes()

void org.freedesktop.dbus.Message.appendBytes ( byte []  buf)
inlineprotected

Appends a buffer to the buffer list.

289  {
290  if (null == buf) return;
291  if (preallocated > 0) {
292  if (paofs + buf.length > pabuf.length)
293  throw new ArrayIndexOutOfBoundsException(MessageFormat.format(getString("arrayOutOfBounds"), new Object[]{paofs, pabuf.length, buf.length}));
294  System.arraycopy(buf, 0, pabuf, paofs, buf.length);
295  paofs += buf.length;
296  preallocated -= buf.length;
297  } else {
298  if (bufferuse == wiredata.length) {
299  if (Debug.debug) Debug.print(Debug.VERBOSE, "Resizing " + bufferuse);
300  byte[][] temp = new byte[wiredata.length + BUFFERINCREMENT][];
301  System.arraycopy(wiredata, 0, temp, 0, wiredata.length);
302  wiredata = temp;
303  }
304  wiredata[bufferuse++] = buf;
305  bytecounter += buf.length;
306  }
307  }
byte [][] wiredata
Definition: Message.java:156
int bufferuse
Definition: Message.java:170
int preallocated
Definition: Message.java:167
int paofs
Definition: Message.java:168
static final int BUFFERINCREMENT
Definition: Message.java:153
byte [] pabuf
Definition: Message.java:169
long bytecounter
Definition: Message.java:157

◆ appendint()

void org.freedesktop.dbus.Message.appendint ( long  l,
int  width 
)
inline

Marshalls an integer of a given width and appends it to the message. Endianness is determined from the message.

引数
lThe integer to marshall.
widthThe byte-width of the int.
391  {
392  byte[] buf = new byte[width];
393  marshallint(l, buf, 0, width);
394  appendBytes(buf);
395  }
void appendBytes(byte[] buf)
Definition: Message.java:289
void marshallint(long l, byte[] buf, int ofs, int width)
Definition: Message.java:406

◆ appendone()

int org.freedesktop.dbus.Message.appendone ( byte []  sigb,
int  sigofs,
Object  data 
) throws DBusException
inlineprivate

Appends a value to the message. The type of the value is read from a D-Bus signature and used to marshall the value.

引数
sigbA buffer of the D-Bus signature.
sigofsThe offset into the signature corresponding to this value.
dataThe value to marshall.
戻り値
The offset into the signature of the end of this value's type.
535  {
536  try {
537  int i = sigofs;
538  if (Debug.debug) Debug.print(Debug.VERBOSE, (Object) bytecounter);
539  if (Debug.debug) Debug.print(Debug.VERBOSE, "Appending type: " + ((char) sigb[i]) + " value: " + data);
540 
541  // pad to the alignment of this type.
542  pad(sigb[i]);
543  switch (sigb[i]) {
544  case ArgumentType.BYTE:
545  appendByte(((Number) data).byteValue());
546  break;
547  case ArgumentType.BOOLEAN:
548  appendint(((Boolean) data).booleanValue() ? 1 : 0, 4);
549  break;
550  case ArgumentType.DOUBLE:
551  long l = Double.doubleToLongBits(((Number) data).doubleValue());
552  appendint(l, 8);
553  break;
554  case ArgumentType.FLOAT:
555  int rf = Float.floatToIntBits(((Number) data).floatValue());
556  appendint(rf, 4);
557  break;
558  case ArgumentType.UINT32:
559  appendint(((Number) data).longValue(), 4);
560  break;
561  case ArgumentType.INT64:
562  appendint(((Number) data).longValue(), 8);
563  break;
564  case ArgumentType.UINT64:
565  if (big) {
566  appendint(((UInt64) data).top(), 4);
567  appendint(((UInt64) data).bottom(), 4);
568  } else {
569  appendint(((UInt64) data).bottom(), 4);
570  appendint(((UInt64) data).top(), 4);
571  }
572  break;
573  case ArgumentType.INT32:
574  appendint(((Number) data).intValue(), 4);
575  break;
576  case ArgumentType.UINT16:
577  appendint(((Number) data).intValue(), 2);
578  break;
579  case ArgumentType.INT16:
580  appendint(((Number) data).shortValue(), 2);
581  break;
582  case ArgumentType.STRING:
583  case ArgumentType.OBJECT_PATH:
584  // Strings are marshalled as a UInt32 with the length,
585  // followed by the String, followed by a null byte.
586  String payload = data.toString();
587  byte[] payloadbytes = null;
588  try {
589  payloadbytes = payload.getBytes("UTF-8");
590  } catch (UnsupportedEncodingException UEe) {
591  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(UEe);
592  throw new DBusException(getString("utf8NotSupported"));
593  }
594  if (Debug.debug) Debug.print(Debug.VERBOSE, "Appending String of length " + payloadbytes.length);
595  appendint(payloadbytes.length, 4);
596  appendBytes(payloadbytes);
597  appendBytes(padding[1]);
598  //pad(ArgumentType.STRING);? do we need this?
599  break;
600  case ArgumentType.SIGNATURE:
601  // Signatures are marshalled as a byte with the length,
602  // followed by the String, followed by a null byte.
603  // Signatures are generally short, so preallocate the array
604  // for the string, length and null byte.
605  if (data instanceof Type[])
606  payload = Marshalling.getDBusType((Type[]) data);
607  else
608  payload = (String) data;
609  byte[] pbytes = payload.getBytes();
610  preallocate(2 + pbytes.length);
611  appendByte((byte) pbytes.length);
612  appendBytes(pbytes);
613  appendByte((byte) 0);
614  break;
615  case ArgumentType.ARRAY:
616  // Arrays are given as a UInt32 for the length in bytes,
617  // padding to the element alignment, then elements in
618  // order. The length is the length from the end of the
619  // initial padding to the end of the last element.
620  if (Debug.debug) {
621  if (data instanceof Object[])
622  Debug.print(Debug.VERBOSE, "Appending array: " + Arrays.deepToString((Object[]) data));
623  }
624 
625  byte[] alen = new byte[4];
626  appendBytes(alen);
627  pad(sigb[++i]);
628  long c = bytecounter;
629 
630  // optimise primatives
631  if (data.getClass().isArray() &&
632  data.getClass().getComponentType().isPrimitive()) {
633  byte[] primbuf;
634  int algn = getAlignment(sigb[i]);
635  int len = Array.getLength(data);
636  switch (sigb[i]) {
637  case ArgumentType.BYTE:
638  primbuf = (byte[]) data;
639  break;
640  case ArgumentType.INT16:
641  case ArgumentType.INT32:
642  case ArgumentType.INT64:
643  primbuf = new byte[len * algn];
644  for (int j = 0, k = 0; j < len; j++, k += algn)
645  marshallint(Array.getLong(data, j), primbuf, k, algn);
646  break;
647  case ArgumentType.BOOLEAN:
648  primbuf = new byte[len * algn];
649  for (int j = 0, k = 0; j < len; j++, k += algn)
650  marshallint(Array.getBoolean(data, j) ? 1 : 0, primbuf, k, algn);
651  break;
652  case ArgumentType.DOUBLE:
653  primbuf = new byte[len * algn];
654  if (data instanceof float[])
655  for (int j = 0, k = 0; j < len; j++, k += algn)
656  marshallint(Double.doubleToRawLongBits(((float[]) data)[j]),
657  primbuf, k, algn);
658  else
659  for (int j = 0, k = 0; j < len; j++, k += algn)
660  marshallint(Double.doubleToRawLongBits(((double[]) data)[j]),
661  primbuf, k, algn);
662  break;
663  case ArgumentType.FLOAT:
664  primbuf = new byte[len * algn];
665  for (int j = 0, k = 0; j < len; j++, k += algn)
666  marshallint(
667  Float.floatToRawIntBits(((float[]) data)[j]),
668  primbuf, k, algn);
669  break;
670  default:
671  throw new MarshallingException(getString("arraySentAsNonPrimitive"));
672  }
673  appendBytes(primbuf);
674  } else if (data instanceof List) {
675  Object[] contents = ((List) data).toArray();
676  int diff = i;
677  ensureBuffers(contents.length * 4);
678  for (Object o : contents)
679  diff = appendone(sigb, i, o);
680  i = diff;
681  } else if (data instanceof Map) {
682  int diff = i;
683  ensureBuffers(((Map) data).size() * 6);
684  for (Map.Entry<Object, Object> o : ((Map<Object, Object>) data).entrySet())
685  diff = appendone(sigb, i, o);
686  if (i == diff) {
687  // advance the type parser even on 0-size arrays.
688  Vector<Type> temp = new Vector<Type>();
689  byte[] temp2 = new byte[sigb.length - diff];
690  System.arraycopy(sigb, diff, temp2, 0, temp2.length);
691  String temp3 = new String(temp2);
692  int temp4 = Marshalling.getJavaType(temp3, temp, 1);
693  diff += temp4;
694  }
695  i = diff;
696  } else {
697  Object[] contents = (Object[]) data;
698  ensureBuffers(contents.length * 4);
699  int diff = i;
700  for (Object o : contents)
701  diff = appendone(sigb, i, o);
702  i = diff;
703  }
704  if (Debug.debug)
705  Debug.print(Debug.VERBOSE, "start: " + c + " end: " + bytecounter + " length: " + (bytecounter - c));
706  marshallint(bytecounter - c, alen, 0, 4);
707  break;
708  case ArgumentType.STRUCT1:
709  // Structs are aligned to 8 bytes
710  // and simply contain each element marshalled in order
711  Object[] contents;
712  if (data instanceof Container)
713  contents = ((Container) data).getParameters();
714  else
715  contents = (Object[]) data;
716  ensureBuffers(contents.length * 4);
717  int j = 0;
718  for (i++; sigb[i] != ArgumentType.STRUCT2; i++)
719  i = appendone(sigb, i, contents[j++]);
720  break;
721  case ArgumentType.DICT_ENTRY1:
722  // Dict entries are the same as structs.
723  if (data instanceof Map.Entry) {
724  i++;
725  i = appendone(sigb, i, ((Map.Entry) data).getKey());
726  i++;
727  i = appendone(sigb, i, ((Map.Entry) data).getValue());
728  i++;
729  } else {
730  contents = (Object[]) data;
731  j = 0;
732  for (i++; sigb[i] != ArgumentType.DICT_ENTRY2; i++)
733  i = appendone(sigb, i, contents[j++]);
734  }
735  break;
736  case ArgumentType.VARIANT:
737  // Variants are marshalled as a signature
738  // followed by the value.
739  if (data instanceof Variant) {
740  Variant var = (Variant) data;
741  appendone(new byte[]{ArgumentType.SIGNATURE}, 0, var.getSig());
742  appendone((var.getSig()).getBytes(), 0, var.getValue());
743  } else if (data instanceof Object[]) {
744  contents = (Object[]) data;
745  appendone(new byte[]{ArgumentType.SIGNATURE}, 0, contents[0]);
746  appendone(((String) contents[0]).getBytes(), 0, contents[1]);
747  } else {
748  String sig = Marshalling.getDBusType(data.getClass())[0];
749  appendone(new byte[]{ArgumentType.SIGNATURE}, 0, sig);
750  appendone((sig).getBytes(), 0, data);
751  }
752  break;
753  }
754  return i;
755  } catch (ClassCastException CCe) {
756  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, CCe);
757  throw new MarshallingException(MessageFormat.format(getString("unconvertableType"), new Object[]{data.getClass().getName(), sigb[sigofs]}));
758  }
759  }
void appendBytes(byte[] buf)
Definition: Message.java:289
void ensureBuffers(int num)
Definition: Message.java:275
void preallocate(int num)
Definition: Message.java:262
static byte [][] padding
Definition: Message.java:136
boolean big
Definition: Message.java:155
void pad(byte type)
Definition: Message.java:764
long bytecounter
Definition: Message.java:157
void appendint(long l, int width)
Definition: Message.java:391
int appendone(byte[] sigb, int sigofs, Object data)
Definition: Message.java:535
void marshallint(long l, byte[] buf, int ofs, int width)
Definition: Message.java:406
void appendByte(byte b)
Definition: Message.java:312
static int getAlignment(byte type)
Definition: Message.java:782

◆ demarshallint() [1/2]

long org.freedesktop.dbus.Message.demarshallint ( byte []  buf,
int  ofs,
int  width 
)
inline

Demarshalls an integer of a given width from a buffer. Endianness is determined from the format of the message.

引数
bufThe buffer to demarshall from.
ofsThe offset to demarshall from.
widthThe byte-width of the int.
336  {
337  return big ? demarshallintBig(buf, ofs, width) : demarshallintLittle(buf, ofs, width);
338  }
static long demarshallintBig(byte[] buf, int ofs, int width)
Definition: Message.java:359
static long demarshallintLittle(byte[] buf, int ofs, int width)
Definition: Message.java:375
boolean big
Definition: Message.java:155

◆ demarshallint() [2/2]

static long org.freedesktop.dbus.Message.demarshallint ( byte []  buf,
int  ofs,
byte  endian,
int  width 
)
inlinestatic

Demarshalls an integer of a given width from a buffer.

引数
bufThe buffer to demarshall from.
ofsThe offset to demarshall from.
endianThe endianness to use in demarshalling.
widthThe byte-width of the int.
348  {
349  return endian == Endian.BIG ? demarshallintBig(buf, ofs, width) : demarshallintLittle(buf, ofs, width);
350  }
static long demarshallintBig(byte[] buf, int ofs, int width)
Definition: Message.java:359
static long demarshallintLittle(byte[] buf, int ofs, int width)
Definition: Message.java:375

◆ demarshallintBig()

static long org.freedesktop.dbus.Message.demarshallintBig ( byte []  buf,
int  ofs,
int  width 
)
inlinestatic

Demarshalls an integer of a given width from a buffer using big-endian format.

引数
bufThe buffer to demarshall from.
ofsThe offset to demarshall from.
widthThe byte-width of the int.
359  {
360  long l = 0;
361  for (int i = 0; i < width; i++) {
362  l <<= 8;
363  l |= (buf[ofs + i] & 0xFF);
364  }
365  return l;
366  }

◆ demarshallintLittle()

static long org.freedesktop.dbus.Message.demarshallintLittle ( byte []  buf,
int  ofs,
int  width 
)
inlinestatic

Demarshalls an integer of a given width from a buffer using little-endian format.

引数
bufThe buffer to demarshall from.
ofsThe offset to demarshall from.
widthThe byte-width of the int.
375  {
376  long l = 0;
377  for (int i = (width - 1); i >= 0; i--) {
378  l <<= 8;
379  l |= (buf[ofs + i] & 0xFF);
380  }
381  return l;
382  }

◆ ensureBuffers()

void org.freedesktop.dbus.Message.ensureBuffers ( int  num)
inlineprivate

Ensures there are enough free buffers.

引数
numnumber of free buffers to create.
275  {
276  int increase = num - wiredata.length + bufferuse;
277  if (increase > 0) {
278  if (increase < BUFFERINCREMENT) increase = BUFFERINCREMENT;
279  if (Debug.debug) Debug.print(Debug.VERBOSE, "Resizing " + bufferuse);
280  byte[][] temp = new byte[wiredata.length + increase][];
281  System.arraycopy(wiredata, 0, temp, 0, wiredata.length);
282  wiredata = temp;
283  }
284  }
byte [][] wiredata
Definition: Message.java:156
int bufferuse
Definition: Message.java:170
static final int BUFFERINCREMENT
Definition: Message.java:153

◆ extract() [1/2]

Object [] org.freedesktop.dbus.Message.extract ( String  sig,
byte []  buf,
int  ofs 
) throws DBusException
inline

Demarshall values from a buffer.

引数
sigThe D-Bus signature(s) of the value(s).
bufThe buffer to demarshall from.
ofsThe offset into the data buffer to start.
戻り値
The demarshalled value(s).
1076  {
1077  return extract(sig, buf, new int[]{0, ofs});
1078  }
Object [] extract(String sig, byte[] buf, int ofs)
Definition: Message.java:1076

◆ extract() [2/2]

Object [] org.freedesktop.dbus.Message.extract ( String  sig,
byte []  buf,
int []  ofs 
) throws DBusException
inline

Demarshall values from a buffer.

引数
sigThe D-Bus signature(s) of the value(s).
bufThe buffer to demarshall from.
ofsAn array of two ints, the offset into the signature and the offset into the data buffer. These values will be updated to the start of the next value ofter demarshalling.
戻り値
The demarshalled value(s).
1090  {
1091  if (Debug.debug)
1092  Debug.print(Debug.VERBOSE, "extract(" + sig + ",#" + buf.length + ", {" + ofs[0] + "," + ofs[1] + "}");
1093  Vector<Object> rv = new Vector<Object>();
1094  byte[] sigb = sig.getBytes();
1095  for (int[] i = ofs; i[0] < sigb.length; i[0]++) {
1096  rv.add(extractone(sigb, buf, i, false));
1097  }
1098  return rv.toArray();
1099  }
Object extractone(byte[] sigb, byte[] buf, int[] ofs, boolean contained)
Definition: Message.java:858

◆ extractone()

Object org.freedesktop.dbus.Message.extractone ( byte []  sigb,
byte []  buf,
int []  ofs,
boolean  contained 
) throws DBusException
inlineprivate

Demarshall one value from a buffer.

引数
sigbA buffer of the D-Bus signature.
bufThe buffer to demarshall from.
ofsAn array of two ints, the offset into the signature buffer and the offset into the data buffer. These values will be updated to the start of the next value ofter demarshalling.
containedconverts nested arrays to Lists
戻り値
The demarshalled value.
858  {
859  if (Debug.debug)
860  Debug.print(Debug.VERBOSE, "Extracting type: " + ((char) sigb[ofs[0]]) + " from offset " + ofs[1]);
861  Object rv = null;
862  ofs[1] = align(ofs[1], sigb[ofs[0]]);
863  switch (sigb[ofs[0]]) {
864  case ArgumentType.BYTE:
865  rv = buf[ofs[1]++];
866  break;
867  case ArgumentType.UINT32:
868  rv = new UInt32(demarshallint(buf, ofs[1], 4));
869  ofs[1] += 4;
870  break;
871  case ArgumentType.INT32:
872  rv = (int) demarshallint(buf, ofs[1], 4);
873  ofs[1] += 4;
874  break;
875  case ArgumentType.INT16:
876  rv = (short) demarshallint(buf, ofs[1], 2);
877  ofs[1] += 2;
878  break;
879  case ArgumentType.UINT16:
880  rv = new UInt16((int) demarshallint(buf, ofs[1], 2));
881  ofs[1] += 2;
882  break;
883  case ArgumentType.INT64:
884  rv = demarshallint(buf, ofs[1], 8);
885  ofs[1] += 8;
886  break;
887  case ArgumentType.UINT64:
888  long top;
889  long bottom;
890  if (big) {
891  top = demarshallint(buf, ofs[1], 4);
892  ofs[1] += 4;
893  bottom = demarshallint(buf, ofs[1], 4);
894  } else {
895  bottom = demarshallint(buf, ofs[1], 4);
896  ofs[1] += 4;
897  top = demarshallint(buf, ofs[1], 4);
898  }
899  rv = new UInt64(top, bottom);
900  ofs[1] += 4;
901  break;
902  case ArgumentType.DOUBLE:
903  long l = demarshallint(buf, ofs[1], 8);
904  ofs[1] += 8;
905  rv = Double.longBitsToDouble(l);
906  break;
907  case ArgumentType.FLOAT:
908  int rf = (int) demarshallint(buf, ofs[1], 4);
909  ofs[1] += 4;
910  rv = Float.intBitsToFloat(rf);
911  break;
912  case ArgumentType.BOOLEAN:
913  rf = (int) demarshallint(buf, ofs[1], 4);
914  ofs[1] += 4;
915  rv = (1 == rf) ? Boolean.TRUE : Boolean.FALSE;
916  break;
917  case ArgumentType.ARRAY:
918  long size = demarshallint(buf, ofs[1], 4);
919  if (Debug.debug) Debug.print(Debug.VERBOSE, "Reading array of size: " + size);
920  ofs[1] += 4;
921  byte algn = (byte) getAlignment(sigb[++ofs[0]]);
922  ofs[1] = align(ofs[1], sigb[ofs[0]]);
923  int length = (int) (size / algn);
924  if (length > DBusConnection.MAX_ARRAY_LENGTH)
925  throw new MarshallingException(getString("arrayMustNotExceed") + DBusConnection.MAX_ARRAY_LENGTH);
926  // optimise primatives
927  switch (sigb[ofs[0]]) {
928  case ArgumentType.BYTE:
929  rv = new byte[length];
930  System.arraycopy(buf, ofs[1], rv, 0, length);
931  ofs[1] += size;
932  break;
933  case ArgumentType.INT16:
934  rv = new short[length];
935  for (int j = 0; j < length; j++, ofs[1] += algn)
936  ((short[]) rv)[j] = (short) demarshallint(buf, ofs[1], algn);
937  break;
938  case ArgumentType.INT32:
939  rv = new int[length];
940  for (int j = 0; j < length; j++, ofs[1] += algn)
941  ((int[]) rv)[j] = (int) demarshallint(buf, ofs[1], algn);
942  break;
943  case ArgumentType.INT64:
944  rv = new long[length];
945  for (int j = 0; j < length; j++, ofs[1] += algn)
946  ((long[]) rv)[j] = demarshallint(buf, ofs[1], algn);
947  break;
948  case ArgumentType.BOOLEAN:
949  rv = new boolean[length];
950  for (int j = 0; j < length; j++, ofs[1] += algn)
951  ((boolean[]) rv)[j] = (1 == demarshallint(buf, ofs[1], algn));
952  break;
953  case ArgumentType.FLOAT:
954  rv = new float[length];
955  for (int j = 0; j < length; j++, ofs[1] += algn)
956  ((float[]) rv)[j] =
957  Float.intBitsToFloat((int) demarshallint(buf, ofs[1], algn));
958  break;
959  case ArgumentType.DOUBLE:
960  rv = new double[length];
961  for (int j = 0; j < length; j++, ofs[1] += algn)
962  ((double[]) rv)[j] =
963  Double.longBitsToDouble(demarshallint(buf, ofs[1], algn));
964  break;
965  case ArgumentType.DICT_ENTRY1:
966  if (0 == size) {
967  // advance the type parser even on 0-size arrays.
968  Vector<Type> temp = new Vector<Type>();
969  byte[] temp2 = new byte[sigb.length - ofs[0]];
970  System.arraycopy(sigb, ofs[0], temp2, 0, temp2.length);
971  String temp3 = new String(temp2);
972  // ofs[0] gets incremented anyway. Leave one character on the stack
973  int temp4 = Marshalling.getJavaType(temp3, temp, 1) - 1;
974  ofs[0] += temp4;
975  if (Debug.debug)
976  Debug.print(Debug.VERBOSE, "Aligned type: " + temp3 + " " + temp4 + " " + ofs[0]);
977  }
978  int ofssave = ofs[0];
979  long end = ofs[1] + size;
980  Vector<Object[]> entries = new Vector<Object[]>();
981  while (ofs[1] < end) {
982  ofs[0] = ofssave;
983  entries.add((Object[]) extractone(sigb, buf, ofs, true));
984  }
985  rv = new DBusMap<Object, Object>(entries.toArray(new Object[0][]));
986  break;
987  default:
988  if (0 == size) {
989  // advance the type parser even on 0-size arrays.
990  Vector<Type> temp = new Vector<Type>();
991  byte[] temp2 = new byte[sigb.length - ofs[0]];
992  System.arraycopy(sigb, ofs[0], temp2, 0, temp2.length);
993  String temp3 = new String(temp2);
994  // ofs[0] gets incremented anyway. Leave one character on the stack
995  int temp4 = Marshalling.getJavaType(temp3, temp, 1) - 1;
996  ofs[0] += temp4;
997  if (Debug.debug)
998  Debug.print(Debug.VERBOSE, "Aligned type: " + temp3 + " " + temp4 + " " + ofs[0]);
999  }
1000  ofssave = ofs[0];
1001  end = ofs[1] + size;
1002  Vector<Object> contents = new Vector<Object>();
1003  while (ofs[1] < end) {
1004  ofs[0] = ofssave;
1005  contents.add(extractone(sigb, buf, ofs, true));
1006  }
1007  rv = contents;
1008  }
1009  if (contained && !(rv instanceof List) && !(rv instanceof Map))
1010  rv = ArrayFrob.listify(rv);
1011  break;
1012  case ArgumentType.STRUCT1:
1013  Vector<Object> contents = new Vector<Object>();
1014  while (sigb[++ofs[0]] != ArgumentType.STRUCT2)
1015  contents.add(extractone(sigb, buf, ofs, true));
1016  rv = contents.toArray();
1017  break;
1018  case ArgumentType.DICT_ENTRY1:
1019  Object[] decontents = new Object[2];
1020  if (Debug.debug)
1021  Debug.print(Debug.VERBOSE, "Extracting Dict Entry (" + Hexdump.toAscii(sigb, ofs[0], sigb.length - ofs[0]) + ") from: " + Hexdump.toHex(buf, ofs[1], buf.length - ofs[1]));
1022  ofs[0]++;
1023  decontents[0] = extractone(sigb, buf, ofs, true);
1024  ofs[0]++;
1025  decontents[1] = extractone(sigb, buf, ofs, true);
1026  ofs[0]++;
1027  rv = decontents;
1028  break;
1029  case ArgumentType.VARIANT:
1030  int[] newofs = new int[]{0, ofs[1]};
1031  String sig = (String) extract(ArgumentType.SIGNATURE_STRING, buf, newofs)[0];
1032  newofs[0] = 0;
1033  rv = new Variant<Object>(extract(sig, buf, newofs)[0], sig);
1034  ofs[1] = newofs[1];
1035  break;
1036  case ArgumentType.STRING:
1037  length = (int) demarshallint(buf, ofs[1], 4);
1038  ofs[1] += 4;
1039  try {
1040  rv = new String(buf, ofs[1], length, "UTF-8");
1041  } catch (UnsupportedEncodingException UEe) {
1042  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(UEe);
1043  throw new DBusException(getString("utf8NotSupported"));
1044  }
1045  ofs[1] += length + 1;
1046  break;
1047  case ArgumentType.OBJECT_PATH:
1048  length = (int) demarshallint(buf, ofs[1], 4);
1049  ofs[1] += 4;
1050  rv = new ObjectPath(getSource(), new String(buf, ofs[1], length));
1051  ofs[1] += length + 1;
1052  break;
1053  case ArgumentType.SIGNATURE:
1054  length = (buf[ofs[1]++] & 0xFF);
1055  rv = new String(buf, ofs[1], length);
1056  ofs[1] += length + 1;
1057  break;
1058  default:
1059  throw new UnknownTypeCodeException(sigb[ofs[0]]);
1060  }
1061  if (Debug.debug) if (rv instanceof Object[])
1062  Debug.print(Debug.VERBOSE, "Extracted: " + Arrays.deepToString((Object[]) rv) + " (now at " + ofs[1] + ")");
1063  else
1064  Debug.print(Debug.VERBOSE, "Extracted: " + rv + " (now at " + ofs[1] + ")");
1065  return rv;
1066  }
Object [] extract(String sig, byte[] buf, int ofs)
Definition: Message.java:1076
Object extractone(byte[] sigb, byte[] buf, int[] ofs, boolean contained)
Definition: Message.java:858
int align(int current, byte type)
Definition: Message.java:840
boolean big
Definition: Message.java:155
long demarshallint(byte[] buf, int ofs, int width)
Definition: Message.java:336
static int getAlignment(byte type)
Definition: Message.java:782
String getSource()
Definition: Message.java:1104

◆ getAlignment()

static int org.freedesktop.dbus.Message.getAlignment ( byte  type)
inlinestatic

Return the alignment for a given type.

782  {
783  switch (type) {
784  case 2:
785  case ArgumentType.INT16:
786  case ArgumentType.UINT16:
787  return 2;
788  case 4:
789  case ArgumentType.BOOLEAN:
790  case ArgumentType.FLOAT:
791  case ArgumentType.INT32:
792  case ArgumentType.UINT32:
793  case ArgumentType.STRING:
794  case ArgumentType.OBJECT_PATH:
795  case ArgumentType.ARRAY:
796  return 4;
797  case 8:
798  case ArgumentType.INT64:
799  case ArgumentType.UINT64:
800  case ArgumentType.DOUBLE:
801  case ArgumentType.STRUCT:
802  case ArgumentType.DICT_ENTRY:
803  case ArgumentType.STRUCT1:
804  case ArgumentType.DICT_ENTRY1:
805  case ArgumentType.STRUCT2:
806  case ArgumentType.DICT_ENTRY2:
807  return 8;
808  case 1:
809  case ArgumentType.BYTE:
810  case ArgumentType.SIGNATURE:
811  case ArgumentType.VARIANT:
812  default:
813  return 1;
814  }
815  }
byte type
Definition: Message.java:161

◆ getDestination()

String org.freedesktop.dbus.Message.getDestination ( )
inline

Returns the destination of the message.

1111  {
1112  return (String) headers.get(HeaderField.DESTINATION);
1113  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getFlags()

int org.freedesktop.dbus.Message.getFlags ( )
inline

Returns the message flags.

1151  {
1152  return flags;
1153  }
byte flags
Definition: Message.java:162

◆ getHeader()

Object org.freedesktop.dbus.Message.getHeader ( byte  type)
inline

Returns the value of the header field of a given field.

引数
typeThe field to return.
戻り値
The value of the field or null if unset.
520  {
521  return headers.get(type);
522  }
byte type
Definition: Message.java:161
Map< Byte, Object > headers
Definition: Message.java:158

◆ getHeaderFieldName()

static String org.freedesktop.dbus.Message.getHeaderFieldName ( byte  field)
inlinestatic

Returns the name of the given header field.

175  {
176  switch (field) {
177  case HeaderField.PATH:
178  return "Path";
179  case HeaderField.INTERFACE:
180  return "Interface";
181  case HeaderField.MEMBER:
182  return "Member";
183  case HeaderField.ERROR_NAME:
184  return "Error Name";
185  case HeaderField.REPLY_SERIAL:
186  return "Reply Serial";
187  case HeaderField.DESTINATION:
188  return "Destination";
189  case HeaderField.SENDER:
190  return "Sender";
191  case HeaderField.SIGNATURE:
192  return "Signature";
193  default:
194  return "Invalid";
195  }
196  }

◆ getInterface()

String org.freedesktop.dbus.Message.getInterface ( )
inline

Returns the interface of the message.

1118  {
1119  return (String) headers.get(HeaderField.INTERFACE);
1120  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getName()

String org.freedesktop.dbus.Message.getName ( )
inline

Returns the member name or error name this message represents.

1134  {
1135  if (this instanceof Error)
1136  return (String) headers.get(HeaderField.ERROR_NAME);
1137  else
1138  return (String) headers.get(HeaderField.MEMBER);
1139  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getParameters()

Object [] org.freedesktop.dbus.Message.getParameters ( ) throws DBusException
inline

Parses and returns the parameters to this message as an Object array.

1178  {
1179  if (null == args && null != body) {
1180  String sig = (String) headers.get(HeaderField.SIGNATURE);
1181  if (null != sig && 0 != body.length) {
1182  args = extract(sig, body, 0);
1183  } else args = new Object[0];
1184  }
1185  return args;
1186  }
Object [] extract(String sig, byte[] buf, int ofs)
Definition: Message.java:1076
Map< Byte, Object > headers
Definition: Message.java:158
byte [] body
Definition: Message.java:165
Object [] args
Definition: Message.java:164

◆ getPath()

String org.freedesktop.dbus.Message.getPath ( )
inline

Returns the object path of the message.

1125  {
1126  Object o = headers.get(HeaderField.PATH);
1127  if (null == o) return null;
1128  return o.toString();
1129  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getReplySerial()

long org.freedesktop.dbus.Message.getReplySerial ( )
inline

If this is a reply to a message, this returns its serial.

戻り値
The reply serial, or 0 if it is not a reply.
1169  {
1170  Number l = (Number) headers.get(HeaderField.REPLY_SERIAL);
1171  if (null == l) return 0;
1172  return l.longValue();
1173  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getSerial()

long org.freedesktop.dbus.Message.getSerial ( )
inline

Returns the message serial ID (unique for this connection)

戻り値
the message serial.
1160  {
1161  return serial;
1162  }
long serial
Definition: Message.java:160

◆ getSig()

String org.freedesktop.dbus.Message.getSig ( )
inline

Returns the dbus signature of the parameters.

1144  {
1145  return (String) headers.get(HeaderField.SIGNATURE);
1146  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getSource()

String org.freedesktop.dbus.Message.getSource ( )
inline

Returns the Bus ID that sent the message.

1104  {
1105  return (String) headers.get(HeaderField.SENDER);
1106  }
Map< Byte, Object > headers
Definition: Message.java:158

◆ getWireData()

byte [][] org.freedesktop.dbus.Message.getWireData ( )
inline
442  {
443  return wiredata;
444  }
byte [][] wiredata
Definition: Message.java:156

◆ marshallint()

void org.freedesktop.dbus.Message.marshallint ( long  l,
byte []  buf,
int  ofs,
int  width 
)
inline

Marshalls an integer of a given width into a buffer. Endianness is determined from the message.

引数
lThe integer to marshall.
bufThe buffer to marshall to.
ofsThe offset to marshall to.
widthThe byte-width of the int.
406  {
407  if (big) marshallintBig(l, buf, ofs, width);
408  else marshallintLittle(l, buf, ofs, width);
409  if (Debug.debug) Debug.print(Debug.VERBOSE, "Marshalled int " + l + " to " + Hexdump.toHex(buf, ofs, width));
410  }
static void marshallintLittle(long l, byte[] buf, int ofs, int width)
Definition: Message.java:435
static void marshallintBig(long l, byte[] buf, int ofs, int width)
Definition: Message.java:420
boolean big
Definition: Message.java:155

◆ marshallintBig()

static void org.freedesktop.dbus.Message.marshallintBig ( long  l,
byte []  buf,
int  ofs,
int  width 
)
inlinestatic

Marshalls an integer of a given width into a buffer using big-endian format.

引数
lThe integer to marshall.
bufThe buffer to marshall to.
ofsThe offset to marshall to.
widthThe byte-width of the int.
420  {
421  for (int i = (width - 1); i >= 0; i--) {
422  buf[i + ofs] = (byte) (l & 0xFF);
423  l >>= 8;
424  }
425  }

◆ marshallintLittle()

static void org.freedesktop.dbus.Message.marshallintLittle ( long  l,
byte []  buf,
int  ofs,
int  width 
)
inlinestatic

Marshalls an integer of a given width into a buffer using little-endian format.

引数
lThe integer to marshall.
bufThe buffer to demarshall to.
ofsThe offset to demarshall to.
widthThe byte-width of the int.
435  {
436  for (int i = 0; i < width; i++) {
437  buf[i + ofs] = (byte) (l & 0xFF);
438  l >>= 8;
439  }
440  }

◆ pad()

void org.freedesktop.dbus.Message.pad ( byte  type)
inline

Pad the message to the proper alignment for the given type.

764  {
765  if (Debug.debug) Debug.print(Debug.VERBOSE, "padding for " + (char) type);
766  int a = getAlignment(type);
767  if (Debug.debug) Debug.print(Debug.VERBOSE, preallocated + " " + paofs + " " + bytecounter + " " + a);
768  int b = (int) ((bytecounter - preallocated) % a);
769  if (0 == b) return;
770  a = (a - b);
771  if (preallocated > 0) {
772  paofs += a;
773  preallocated -= a;
774  } else
775  appendBytes(padding[a]);
776  if (Debug.debug) Debug.print(Debug.VERBOSE, preallocated + " " + paofs + " " + bytecounter + " " + a);
777  }
void appendBytes(byte[] buf)
Definition: Message.java:289
byte type
Definition: Message.java:161
int preallocated
Definition: Message.java:167
int paofs
Definition: Message.java:168
static byte [][] padding
Definition: Message.java:136
long bytecounter
Definition: Message.java:157
static int getAlignment(byte type)
Definition: Message.java:782

◆ populate()

void org.freedesktop.dbus.Message.populate ( byte []  msg,
byte []  headers,
byte []  body 
) throws DBusException
inlinepackage

Create a message from wire-format data.

引数
msgD-Bus serialized data of type yyyuu
headersD-Bus serialized data of type a(yv)
bodyD-Bus serialized data of the signature defined in headers.
237  {
238  big = (msg[0] == Endian.BIG);
239  type = msg[1];
240  flags = msg[2];
241  protover = msg[3];
242  wiredata[0] = msg;
243  wiredata[1] = headers;
244  wiredata[2] = body;
245  this.body = body;
246  bufferuse = 3;
247  bodylen = ((Number) extract(Message.ArgumentType.UINT32_STRING, msg, 4)[0]).longValue();
248  serial = ((Number) extract(Message.ArgumentType.UINT32_STRING, msg, 8)[0]).longValue();
249  bytecounter = msg.length + headers.length + body.length;
250  if (Debug.debug) Debug.print(Debug.VERBOSE, headers);
251  Object[] hs = extract("a(yv)", headers, 0);
252  if (Debug.debug) Debug.print(Debug.VERBOSE, Arrays.deepToString(hs));
253  for (Object o : (Vector<Object>) hs[0]) {
254  this.headers.put((Byte) ((Object[]) o)[0], ((Variant<Object>) ((Object[]) o)[1]).getValue());
255  }
256  }
Object [] extract(String sig, byte[] buf, int ofs)
Definition: Message.java:1076
byte type
Definition: Message.java:161
byte [][] wiredata
Definition: Message.java:156
int bufferuse
Definition: Message.java:170
long bodylen
Definition: Message.java:166
Message()
Definition: Message.java:223
byte flags
Definition: Message.java:162
Map< Byte, Object > headers
Definition: Message.java:158
byte [] body
Definition: Message.java:165
byte protover
Definition: Message.java:163
boolean big
Definition: Message.java:155
long bytecounter
Definition: Message.java:157
long serial
Definition: Message.java:160

◆ preallocate()

void org.freedesktop.dbus.Message.preallocate ( int  num)
inlineprivate

Create a buffer of num bytes. Data is copied to this rather than added to the buffer list.

262  {
263  preallocated = 0;
264  pabuf = new byte[num];
266  preallocated = num;
267  paofs = 0;
268  }
void appendBytes(byte[] buf)
Definition: Message.java:289
int preallocated
Definition: Message.java:167
int paofs
Definition: Message.java:168
byte [] pabuf
Definition: Message.java:169

◆ setArgs()

void org.freedesktop.dbus.Message.setArgs ( Object []  args)
inlineprotected
1188  {
1189  this.args = args;
1190  }
Object [] args
Definition: Message.java:164

◆ setSource()

void org.freedesktop.dbus.Message.setSource ( String  source) throws DBusException
inline

Warning, do not use this method unless you really know what you are doing.

1195  {
1196  if (null != body) {
1197  wiredata = new byte[BUFFERINCREMENT][];
1198  bufferuse = 0;
1199  bytecounter = 0;
1200  preallocate(12);
1201  append("yyyyuu", big ? Endian.BIG : Endian.LITTLE, type, flags, protover, bodylen, serial);
1202  headers.put(HeaderField.SENDER, source);
1203  Object[][] newhead = new Object[headers.size()][];
1204  int i = 0;
1205  for (Byte b : headers.keySet()) {
1206  newhead[i] = new Object[2];
1207  newhead[i][0] = b;
1208  newhead[i][1] = headers.get(b);
1209  i++;
1210  }
1211  append("a(yv)", (Object) newhead);
1212  pad((byte) 8);
1213  appendBytes(body);
1214  }
1215  }
void appendBytes(byte[] buf)
Definition: Message.java:289
byte type
Definition: Message.java:161
byte [][] wiredata
Definition: Message.java:156
int bufferuse
Definition: Message.java:170
long bodylen
Definition: Message.java:166
void preallocate(int num)
Definition: Message.java:262
byte flags
Definition: Message.java:162
Map< Byte, Object > headers
Definition: Message.java:158
byte [] body
Definition: Message.java:165
byte protover
Definition: Message.java:163
boolean big
Definition: Message.java:155
static final int BUFFERINCREMENT
Definition: Message.java:153
void pad(byte type)
Definition: Message.java:764
long bytecounter
Definition: Message.java:157
void append(String sig, Object... data)
Definition: Message.java:823
long serial
Definition: Message.java:160

◆ toString()

String org.freedesktop.dbus.Message.toString ( )
inline

Formats the message in a human-readable format.

449  {
450  StringBuffer sb = new StringBuffer();
451  sb.append(getClass().getSimpleName());
452  sb.append('(');
453  sb.append(flags);
454  sb.append(',');
455  sb.append(serial);
456  sb.append(')');
457  sb.append(' ');
458  sb.append('{');
459  sb.append(' ');
460  if (headers.size() == 0)
461  sb.append('}');
462  else {
463  for (Byte field : headers.keySet()) {
464  sb.append(getHeaderFieldName(field));
465  sb.append('=');
466  sb.append('>');
467  sb.append(headers.get(field).toString());
468  sb.append(',');
469  sb.append(' ');
470  }
471  sb.setCharAt(sb.length() - 2, ' ');
472  sb.setCharAt(sb.length() - 1, '}');
473  }
474  sb.append(' ');
475  sb.append('{');
476  sb.append(' ');
477  Object[] args = null;
478  try {
479  args = getParameters();
480  } catch (DBusException DBe) {
481  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe);
482  }
483  if (null == args || 0 == args.length)
484  sb.append('}');
485  else {
486  for (Object o : args) {
487  if (o instanceof Object[])
488  sb.append(Arrays.deepToString((Object[]) o));
489  else if (o instanceof byte[])
490  sb.append(Arrays.toString((byte[]) o));
491  else if (o instanceof int[])
492  sb.append(Arrays.toString((int[]) o));
493  else if (o instanceof short[])
494  sb.append(Arrays.toString((short[]) o));
495  else if (o instanceof long[])
496  sb.append(Arrays.toString((long[]) o));
497  else if (o instanceof boolean[])
498  sb.append(Arrays.toString((boolean[]) o));
499  else if (o instanceof double[])
500  sb.append(Arrays.toString((double[]) o));
501  else if (o instanceof float[])
502  sb.append(Arrays.toString((float[]) o));
503  else
504  sb.append(o.toString());
505  sb.append(',');
506  sb.append(' ');
507  }
508  sb.setCharAt(sb.length() - 2, ' ');
509  sb.setCharAt(sb.length() - 1, '}');
510  }
511  return sb.toString();
512  }
static String getHeaderFieldName(byte field)
Definition: Message.java:175
byte flags
Definition: Message.java:162
Map< Byte, Object > headers
Definition: Message.java:158
Object [] args
Definition: Message.java:164
Object [] getParameters()
Definition: Message.java:1178
long serial
Definition: Message.java:160

メンバ詳解

◆ args

Object [] org.freedesktop.dbus.Message.args
private

◆ big

boolean org.freedesktop.dbus.Message.big
private

◆ body

byte [] org.freedesktop.dbus.Message.body
private

◆ bodylen

long org.freedesktop.dbus.Message.bodylen = 0
private

◆ BUFFERINCREMENT

final int org.freedesktop.dbus.Message.BUFFERINCREMENT = 20
staticprivate

Steps to increment the buffer array.

◆ bufferuse

int org.freedesktop.dbus.Message.bufferuse = 0
private

◆ bytecounter

long org.freedesktop.dbus.Message.bytecounter
protected

◆ flags

byte org.freedesktop.dbus.Message.flags
protected

◆ globalserial

long org.freedesktop.dbus.Message.globalserial = 0
staticprotected

◆ headers

Map<Byte, Object> org.freedesktop.dbus.Message.headers
protected

◆ pabuf

byte [] org.freedesktop.dbus.Message.pabuf
private

◆ padding

byte [][] org.freedesktop.dbus.Message.padding
staticprivate

Keep a static reference to each size of padding array to prevent allocation.

◆ paofs

int org.freedesktop.dbus.Message.paofs = 0
private

◆ preallocated

int org.freedesktop.dbus.Message.preallocated = 0
private

◆ PROTOCOL

final byte org.freedesktop.dbus.Message.PROTOCOL = 1
static

The current protocol major version.

◆ protover

byte org.freedesktop.dbus.Message.protover
protected

◆ serial

long org.freedesktop.dbus.Message.serial
protected

◆ type

byte org.freedesktop.dbus.Message.type
protected

◆ wiredata

byte [][] org.freedesktop.dbus.Message.wiredata
protected

このクラス詳解は次のファイルから抽出されました: