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

公開メンバ関数

 Disconnected (String path) throws DBusException
 
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
 

限定公開メンバ関数

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
 

関数

DBusSignal createReal (AbstractConnection conn) throws DBusException
 
void appendbody (AbstractConnection conn) throws DBusException
 
void populate (byte[] msg, byte[] headers, byte[] body) throws DBusException
 

静的関数

static void addInterfaceMap (String java, String dbus)
 
static void addSignalMap (String java, String dbus)
 
static DBusSignal createSignal (Class<? extends DBusSignal > c, String source, String objectpath, String sig, long serial, Object... parameters) throws DBusException
 
 [static initializer]
 

詳解

構築子と解体子

◆ Disconnected()

org.freedesktop.DBus.Local.Disconnected.Disconnected ( String  path) throws DBusException
inline
104  {
105  super(path);
106  }

関数詳解

◆ [static initializer]()

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

◆ addInterfaceMap()

static void org.freedesktop.dbus.DBusSignal.addInterfaceMap ( String  java,
String  dbus 
)
inlinestaticpackageinherited
83  {
84  intnames.put(dbus, java);
85  }
static Map< String, String > intnames
Definition: DBusSignal.java:78

◆ addSignalMap()

static void org.freedesktop.dbus.DBusSignal.addSignalMap ( String  java,
String  dbus 
)
inlinestaticpackageinherited
87  {
88  signames.put(dbus, java);
89  }
static Map< String, String > signames
Definition: DBusSignal.java:77

◆ align()

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

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
inlineinherited

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

◆ appendbody()

void org.freedesktop.dbus.DBusSignal.appendbody ( AbstractConnection  conn) throws DBusException
inlinepackageinherited
246  {
247  if (bodydone) return;
248 
249  Type[] types = typeCache.get(getClass());
250  Object[] args = Marshalling.convertParameters(getParameters(), types, conn);
251  setArgs(args);
252  String sig = getSig();
253 
254  long c = bytecounter;
255  if (null != args && 0 < args.length) append(sig, args);
256  marshallint(bytecounter - c, blen, 0, 4);
257  bodydone = true;
258  }
boolean bodydone
Definition: DBusSignal.java:80
String getSig()
Definition: Message.java:1144
Object [] args
Definition: Message.java:164
static Map< Class<? extends DBusSignal >, Type[]> typeCache
Definition: DBusSignal.java:74
Object [] getParameters()
Definition: Message.java:1178
Class<? extends DBusSignal > c
Definition: DBusSignal.java:79
void setArgs(Object[] args)
Definition: Message.java:1188
long bytecounter
Definition: Message.java:157
void append(String sig, Object... data)
Definition: Message.java:823
byte [] blen
Definition: DBusSignal.java:81
void marshallint(long l, byte[] buf, int ofs, int width)
Definition: Message.java:406

◆ appendByte()

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

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)
inlineprotectedinherited

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 
)
inlineinherited

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

◆ createReal()

DBusSignal org.freedesktop.dbus.DBusSignal.createReal ( AbstractConnection  conn) throws DBusException
inlinepackageinherited
126  {
127  String intname = intnames.get(getInterface());
128  String signame = signames.get(getName());
129  if (null == intname) intname = getInterface();
130  if (null == signame) signame = getName();
131  if (null == c)
132  c = createSignalClass(intname, signame);
133  if (Debug.debug) Debug.print(Debug.DEBUG, "Converting signal to type: " + c);
134  Type[] types = typeCache.get(c);
135  Constructor<? extends DBusSignal> con = conCache.get(c);
136  if (null == types) {
137  con = (Constructor<? extends DBusSignal>) c.getDeclaredConstructors()[0];
138  conCache.put(c, con);
139  Type[] ts = con.getGenericParameterTypes();
140  types = new Type[ts.length - 1];
141  for (int i = 1; i < ts.length; i++)
142  if (ts[i] instanceof TypeVariable)
143  for (Type b : ((TypeVariable<GenericDeclaration>) ts[i]).getBounds())
144  types[i - 1] = b;
145  else
146  types[i - 1] = ts[i];
147  typeCache.put(c, types);
148  }
149 
150  try {
151  DBusSignal s;
152  Object[] args = Marshalling.deSerializeParameters(getParameters(), types, conn);
153  if (null == args) s = (DBusSignal) con.newInstance(getPath());
154  else {
155  Object[] params = new Object[args.length + 1];
156  params[0] = getPath();
157  System.arraycopy(args, 0, params, 1, args.length);
158 
159  if (Debug.debug)
160  Debug.print(Debug.DEBUG, "Creating signal of type " + c + " with parameters " + Arrays.deepToString(params));
161  s = (DBusSignal) con.newInstance(params);
162  }
163  s.headers = headers;
164  s.wiredata = wiredata;
165  s.bytecounter = wiredata.length;
166  return s;
167  } catch (Exception e) {
168  if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e);
169  throw new DBusException(e.getMessage());
170  }
171  }
String getName()
Definition: Message.java:1134
static Map< String, String > intnames
Definition: DBusSignal.java:78
static Class<? extends DBusSignal > createSignalClass(String intname, String signame)
Definition: DBusSignal.java:107
String getInterface()
Definition: Message.java:1118
static Map< String, String > signames
Definition: DBusSignal.java:77
byte [][] wiredata
Definition: Message.java:156
DBusSignal()
Definition: DBusSignal.java:29
static Map< Class<? extends DBusSignal >, Constructor<? extends DBusSignal > > conCache
Definition: DBusSignal.java:76
Map< Byte, Object > headers
Definition: Message.java:158
String getPath()
Definition: Message.java:1125
Object [] args
Definition: Message.java:164
static Map< Class<? extends DBusSignal >, Type[]> typeCache
Definition: DBusSignal.java:74
Object [] getParameters()
Definition: Message.java:1178
Class<? extends DBusSignal > c
Definition: DBusSignal.java:79

◆ createSignal()

static DBusSignal org.freedesktop.dbus.DBusSignal.createSignal ( Class<? extends DBusSignal c,
String  source,
String  objectpath,
String  sig,
long  serial,
Object...  parameters 
) throws DBusException
inlinestaticpackageinherited
91  {
92  String type = "";
93  if (null != c.getEnclosingClass()) {
94  if (null != c.getEnclosingClass().getAnnotation(DBusInterfaceName.class))
95  type = c.getEnclosingClass().getAnnotation(DBusInterfaceName.class).value();
96  else
97  type = AbstractConnection.dollar_pattern.matcher(c.getEnclosingClass().getName()).replaceAll(".");
98 
99  } else
100  throw new DBusException(getString("signalsMustBeMemberOfClass"));
101  DBusSignal s = new internalsig(source, objectpath, type, c.getSimpleName(), sig, parameters, serial);
102  s.c = c;
103  return s;
104  }
byte type
Definition: Message.java:161
DBusSignal()
Definition: DBusSignal.java:29
Class<? extends DBusSignal > c
Definition: DBusSignal.java:79
long serial
Definition: Message.java:160

◆ demarshallint() [1/2]

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

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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  }

◆ extract() [1/2]

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

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
inlineinherited

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

◆ getAlignment()

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

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 ( )
inlineinherited

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 ( )
inlineinherited

Returns the message flags.

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

◆ getHeader()

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

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)
inlinestaticinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited

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 ( )
inlineinherited
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 
)
inlineinherited

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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)
inlineinherited

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
inlinepackageinherited

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

◆ setArgs()

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

◆ setSource()

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

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 ( )
inlineinherited

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

メンバ詳解

◆ bytecounter

long org.freedesktop.dbus.Message.bytecounter
protectedinherited

◆ flags

byte org.freedesktop.dbus.Message.flags
protectedinherited

◆ globalserial

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

◆ headers

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

◆ PROTOCOL

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

The current protocol major version.

◆ protover

byte org.freedesktop.dbus.Message.protover
protectedinherited

◆ serial

long org.freedesktop.dbus.Message.serial
protectedinherited

◆ type

byte org.freedesktop.dbus.Message.type
protectedinherited

◆ wiredata

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

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