diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-06-11 14:36:53 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-06-11 14:36:53 -0700 |
commit | 009a3526d057c7413e6c88ac8255ba0cbb97eb37 (patch) | |
tree | 1c62f43fe628f7c06bbfeb74e2209f83d69bd56c /java/demo | |
parent | Fixed bogus check (diff) | |
download | ice-009a3526d057c7413e6c88ac8255ba0cbb97eb37.tar.bz2 ice-009a3526d057c7413e6c88ac8255ba0cbb97eb37.tar.xz ice-009a3526d057c7413e6c88ac8255ba0cbb97eb37.zip |
demo fixes
Diffstat (limited to 'java/demo')
-rw-r--r-- | java/demo/Ice/invoke/Client.java | 20 | ||||
-rw-r--r-- | java/demo/Ice/invoke/PrinterI.java | 19 | ||||
-rw-r--r-- | java/demo/Ice/value/Value.ice | 2 |
3 files changed, 32 insertions, 9 deletions
diff --git a/java/demo/Ice/invoke/Client.java b/java/demo/Ice/invoke/Client.java index 7c49dd1aeaa..41d4d7f8d81 100644 --- a/java/demo/Ice/invoke/Client.java +++ b/java/demo/Ice/invoke/Client.java @@ -86,7 +86,9 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); out.writeString("The streaming API works!"); + out.endEncapsulation(); // // Invoke operation. @@ -104,8 +106,10 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); final String[] arr = { "The", "streaming", "API", "works!" }; Demo.StringSeqHelper.write(out, arr); + out.endEncapsulation(); // // Invoke operation. @@ -123,10 +127,12 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); java.util.Map<String, String> dict = new java.util.HashMap<String, String>(); dict.put("The", "streaming"); dict.put("API", "works!"); Demo.StringDictHelper.write(out, dict); + out.endEncapsulation(); // // Invoke operation. @@ -144,7 +150,9 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); Demo.Color.green.ice_write(out); + out.endEncapsulation(); // // Invoke operation. @@ -162,10 +170,12 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); Demo.Structure s = new Demo.Structure(); s.name = "red"; s.value = Demo.Color.red; s.ice_write(out); + out.endEncapsulation(); // // Invoke operation. @@ -183,6 +193,7 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); Demo.Structure[] arr = new Demo.Structure[3]; arr[0] = new Demo.Structure(); arr[0].name = "red"; @@ -194,6 +205,7 @@ public class Client extends Ice.Application arr[2].name = "blue"; arr[2].value = Demo.Color.blue; Demo.StructureSeqHelper.write(out, arr); + out.endEncapsulation(); // // Invoke operation. @@ -211,12 +223,13 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); + out.startEncapsulation(); Demo.C c = new Demo.C(); c.s = new Demo.Structure(); c.s.name = "blue"; c.s.value = Demo.Color.blue; Demo.CHelper.write(out, c); - out.writePendingObjects(); + out.endEncapsulation(); // // Invoke operation. @@ -244,10 +257,11 @@ public class Client extends Ice.Application // Unmarshal the results. // Ice.InputStream in = Ice.Util.createInputStream(communicator(), outParams.value); + in.startEncapsulation(); Demo.CHolder c = new Demo.CHolder(); Demo.CHelper.read(in, c); String str = in.readString(); - in.readPendingObjects(); + in.endEncapsulation(); in.destroy(); System.out.println("Got string `" + str + "' and class: s.name=" + c.value.s.name + ", s.value=" + c.value.s.value); @@ -265,6 +279,7 @@ public class Client extends Ice.Application } Ice.InputStream in = Ice.Util.createInputStream(communicator(), outParams.value); + in.startEncapsulation(); try { in.throwException(); @@ -277,6 +292,7 @@ public class Client extends Ice.Application { System.out.println("Unknown user exception"); } + in.endEncapsulation(); in.destroy(); } else if(line.equals("s")) diff --git a/java/demo/Ice/invoke/PrinterI.java b/java/demo/Ice/invoke/PrinterI.java index 9f4c6760817..ed637578466 100644 --- a/java/demo/Ice/invoke/PrinterI.java +++ b/java/demo/Ice/invoke/PrinterI.java @@ -14,22 +14,21 @@ public class PrinterI extends Ice.Blobject { Ice.Communicator communicator = current.adapter.getCommunicator(); - Ice.InputStream in = null; - if(inParams.length > 0) - { - in = Ice.Util.createInputStream(communicator, inParams); - } + Ice.InputStream in = Ice.Util.createInputStream(communicator, inParams); + in.startEncapsulation(); if(current.operation.equals("printString")) { String message = in.readString(); System.out.println("Printing string `" + message + "'"); + in.endEncapsulation(); in.destroy(); return true; } else if(current.operation.equals("printStringSequence")) { String[] seq = Demo.StringSeqHelper.read(in); + in.endEncapsulation(); in.destroy(); System.out.print("Printing string sequence {"); for(int i = 0; i < seq.length; ++i) @@ -46,6 +45,7 @@ public class PrinterI extends Ice.Blobject else if(current.operation.equals("printDictionary")) { java.util.Map<String, String> dict = Demo.StringDictHelper.read(in); + in.endEncapsulation(); in.destroy(); System.out.print("Printing dictionary {"); boolean first = true; @@ -64,6 +64,7 @@ public class PrinterI extends Ice.Blobject else if(current.operation.equals("printEnum")) { Demo.Color c = Demo.Color.ice_read(in); + in.endEncapsulation(); in.destroy(); System.out.println("Printing enum " + c); return true; @@ -72,6 +73,7 @@ public class PrinterI extends Ice.Blobject { Demo.Structure s = new Demo.Structure(); s.ice_read(in); + in.endEncapsulation(); in.destroy(); System.out.println("Printing struct: name=" + s.name + ", value=" + s.value); return true; @@ -79,6 +81,7 @@ public class PrinterI extends Ice.Blobject else if(current.operation.equals("printStructSequence")) { Demo.Structure[] seq = Demo.StructureSeqHelper.read(in); + in.endEncapsulation(); in.destroy(); System.out.print("Printing struct sequence: {"); for(int i = 0; i < seq.length; ++i) @@ -96,7 +99,7 @@ public class PrinterI extends Ice.Blobject { Demo.CHolder c = new Demo.CHolder(); Demo.CHelper.read(in, c); - in.readPendingObjects(); + in.endEncapsulation(); in.destroy(); System.out.println("Printing class: s.name=" + c.value.s.name + ", s.value=" + c.value.s.value); return true; @@ -108,9 +111,11 @@ public class PrinterI extends Ice.Blobject c.s.name = "green"; c.s.value = Demo.Color.green; Ice.OutputStream out = Ice.Util.createOutputStream(communicator); + out.startEncapsulation(); Demo.CHelper.write(out, c); out.writeString("hello"); out.writePendingObjects(); + out.endEncapsulation(); outParams.value = out.finished(); return true; } @@ -120,7 +125,9 @@ public class PrinterI extends Ice.Blobject Demo.PrintFailure ex = new Demo.PrintFailure(); ex.reason = "paper tray empty"; Ice.OutputStream out = Ice.Util.createOutputStream(communicator); + out.startEncapsulation(); out.writeException(ex); + out.endEncapsulation(); outParams.value = out.finished(); return false; } diff --git a/java/demo/Ice/value/Value.ice b/java/demo/Ice/value/Value.ice index b14bd8a6e89..259a8733e5b 100644 --- a/java/demo/Ice/value/Value.ice +++ b/java/demo/Ice/value/Value.ice @@ -38,7 +38,7 @@ interface Initial { Simple getSimple(); void getPrinter(out Printer impl, out Printer* proxy); - Printer getDerivedPrinter(); + ["format:sliced"] Printer getDerivedPrinter(); void throwDerivedPrinter() throws DerivedPrinterException; void shutdown(); }; |