From 4c3ad6fca3a994699b9a19021f6e17d3150dad6e Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Wed, 11 Jul 2012 15:43:39 -0700 Subject: implementing optional params in Java --- java/src/Ice/OutputStream.java | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'java/src/Ice/OutputStream.java') diff --git a/java/src/Ice/OutputStream.java b/java/src/Ice/OutputStream.java index b54fc8a3f92..d921241b2f4 100644 --- a/java/src/Ice/OutputStream.java +++ b/java/src/Ice/OutputStream.java @@ -269,14 +269,7 @@ public interface OutputStream * @param tag The numeric tag associated with the value. * @param type The optional type of the value. **/ - void writeOptional(int tag, Ice.OptionalType type); - - /** - * Indicates that marshaling of a request or reply is finished. - * - * @return The byte sequence containing the encoded request or reply. - **/ - byte[] finished(); + boolean writeOptional(int tag, Ice.OptionalType type); /** * Determines the current position in the stream. @@ -293,6 +286,25 @@ public interface OutputStream **/ void rewrite(int sz, int pos); + /** + * Records the current position and allocates four bytes for a fixed-length (32-bit) + * size value. + **/ + void startSize(); + + /** + * Computes the amount of data written since the previous call to startSize and + * writes that value at the saved position. + **/ + void endSize(); + + /** + * Indicates that marshaling of a request or reply is finished. + * + * @return The byte sequence containing the encoded request or reply. + **/ + byte[] finished(); + /** * Resets this output stream. This method allows the stream to be reused, to avoid creating * unnecessary garbage. -- cgit v1.2.3