/usr/share/doc/libdbus-java/dbus-java/dbus-javase9.html is in libdbus-java-doc 2.8-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | <?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head><title>DBusSerializable</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,2,html -->
<meta name="src" content="dbus-java.tex" />
<meta name="date" content="2014-02-01 19:41:00" />
<link rel="stylesheet" type="text/css" href="dbus-java.css" />
</head><body
>
<!--l. 760--><div class="crosslinks"><p class="noindent">[<a
href="dbus-javase8.html" >prev</a>] [<a
href="dbus-javase8.html#taildbus-javase8.html" >prev-tail</a>] [<a
href="dbus-javase3.html#taildbus-javase9.html">tail</a>] [<a
href="dbus-java.html# " >up</a>] </p></div>
<h3 class="sectionHead"><span class="titlemark">9 </span> <a
id="x30-340009"></a>DBusSerializable</h3>
<!--l. 762--><p class="noindent" >Some people may want to be able to pass their own objects over D-Bus. Obviously only raw
D-Bus types can be sent on the message bus itself, but the Java implementation allows the
creation of serializable objects which can be passed to D-Bus functions and will be converted
to/from D-Bus types by the library.
</p><!--l. 767--><p class="indent" > To create such a class you must implement the
<span
class="cmtt-12">DBusSerializable</span><span class="footnote-mark"><a
href="dbus-java31.html#fn18x0"><sup class="textsuperscript">18</sup></a></span><a
id="x30-34001f18"></a>
class and provide two methods and a zero-argument constructor. The first method has the
signature <span
class="cmtt-12">public Object</span>
</p>
<center class="math-display" >
<img
src="dbus-java0x.png" alt="
" class="math-display" /></center>
<!--l. 770--><p class="nopar" > <span
class="cmtt-12">serialize() throws DBusException </span>and the second must be called <span
class="cmtt-12">deserialize</span>, return
<span
class="cmtt-12">null </span>and take as it’s arguments exactly all the dbus types that are being serialized to <span
class="cmti-12">in order</span>
and <span
class="cmti-12">with parameterization</span>. The serialize method should return the class properties you wish to
serialize, correctly formatted for the wire (<span
class="cmtt-12">DBusConnection.convertParameters() </span>can help
with this), in order in an Object array.
</p><!--l. 778--><p class="indent" > An example of a serializable class can be seen in figure <a
href="#x30-3400216">16<!--tex4ht:ref: fig:serializable --></a>.
</p>
<hr class="figure" /><div class="figure"
>
<a
id="x30-3400216"></a>
<div class="center"
>
<!--l. 782--><p class="noindent" >
</p>
<div class="verbatim" id="verbatim-23">
import java.lang.reflect.Type;
 <br />
 <br />import java.util.List;
 <br />import java.util.Vector;
 <br />
 <br />import org.freedesktop.dbus.DBusConnection;
 <br />import org.freedesktop.dbus.DBusSerializable;
 <br />
 <br />public class TestSerializable implements DBusSerializable
 <br />{
 <br />   private int a;
 <br />   private String b;
 <br />   private Vector<Integer> c;
 <br />   public TestSerializable(int a, String b, Vector<Integer> c)
 <br />   {
 <br />      this.a = a;
 <br />      this.b = b.toString();
 <br />      this.c = c;
 <br />   }
 <br />   public TestSerializable() {}
 <br />   public void deserialize(int a, String b, List<Integer> c)
 <br />   {
 <br />      this.a = a;
 <br />      this.b = b;
 <br />      this.c = new Vector<Integer>(c);
 <br />   }
 <br />   public Object[] serialize()
 <br />   {
 <br />      return new Object[] { a, b, c };
 <br />   }
 <br />   public int getInt() { return a; }
 <br />   public String getString() { return b; }
 <br />   public Vector<Integer> getVector() { return c; }
 <br />   public String toString()
 <br />   {
 <br />      return "TestSerializable{"+a+","+b+","+c+"}";
 <br />   }
 <br />}
</div>
<!--l. 822--><p class="nopar" ></p></div>
<br /> <div class="caption"
><span class="id">Figure 16: </span><span
class="content">A serializable class</span></div><!--tex4ht:label?: x30-3400216 -->
</div><hr class="endfigure" />
<!--l. 830--><div class="crosslinks"><p class="noindent">[<a
href="dbus-javase8.html" >prev</a>] [<a
href="dbus-javase8.html#taildbus-javase8.html" >prev-tail</a>] [<a
href="dbus-javase9.html" >front</a>] [<a
href="dbus-java.html# " >up</a>] </p></div>
<!--l. 830--><p class="indent" > <a
id="taildbus-javase9.html"></a> </p>
</body></html>
|