File: README

package info (click to toggle)
zeroc-ice 3.3.1-12
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 40,720 kB
  • ctags: 46,971
  • sloc: cpp: 241,481; java: 104,729; cs: 66,568; python: 18,996; makefile: 5,797; xml: 5,397; ruby: 4,788; php: 3,172; yacc: 3,113; lex: 2,223; ansic: 1,249; perl: 1,200; sh: 182; sql: 73
file content (37 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download | duplicates (3)
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
This demo illustrates how to transfer serializable Java classes
with Ice.

The Java classes are transferred as byte sequences by Ice. It was
always possible to do this, but required you to explicitly serialize
your class into a byte sequence and then pass that sequence to your
operations to be deserialized by the receiver. You can now accomplish
the same thing more conveniently via metadata.

In your Slice definitions, you must declare a byte sequence using the
"java:serializable" metadata and specify the Java class name, as shown
below:

["java:serializable:JavaClassName"] sequence<byte> SliceType;

Now, wherever you use the declared Slice type in your operations or
data types, you can supply an instance of the designated Java class
and Ice automatically converts it to and from the byte sequence that
is passed over the wire. (The Java class you pass must derive from
java.io.Serializable.)

With the "java:serializable" metadata, if you have a serializable
class as an out-parameter, the out-parameter is passed as
Ice.Holder<JavaClassName>. For example, if you have a Java class
MyPackage.Car as an out-parameter, the out-parameter is passed as
Ice.Holder<MyPackage.Car>.

To run the demo, first start the server:

$ java Server

In a separate window, start the client:

$ java Client

The client allows you to toggle between sending a real class instance
and sending a null value, to show that passing null is supported.