diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/InputStreamI.java | 15 | ||||
-rw-r--r-- | java/src/Ice/OutputStreamI.java | 9 | ||||
-rw-r--r-- | java/src/Ice/Util.java | 35 |
3 files changed, 56 insertions, 3 deletions
diff --git a/java/src/Ice/InputStreamI.java b/java/src/Ice/InputStreamI.java index 1bd53326c14..3d2a200553d 100644 --- a/java/src/Ice/InputStreamI.java +++ b/java/src/Ice/InputStreamI.java @@ -14,10 +14,23 @@ public class InputStreamI implements InputStream public InputStreamI(Communicator communicator, byte[] data) { + initialize(communicator, data, null); + } + + public + InputStreamI(Communicator communicator, byte[] data, EncodingVersion v) + { + initialize(communicator, data, v); + } + + private void + initialize(Communicator communicator, byte[] data, EncodingVersion v) + { _communicator = communicator; IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); - _is = new IceInternal.BasicStream(instance, instance.defaultsAndOverrides().defaultEncoding, true, false); + _is = new IceInternal.BasicStream(instance, v == null ? instance.defaultsAndOverrides().defaultEncoding : v, + true, false); _is.closure(this); _is.resize(data.length, true); IceInternal.Buffer buf = _is.getBuffer(); diff --git a/java/src/Ice/OutputStreamI.java b/java/src/Ice/OutputStreamI.java index 16d2323b809..c9518e64c9b 100644 --- a/java/src/Ice/OutputStreamI.java +++ b/java/src/Ice/OutputStreamI.java @@ -21,6 +21,15 @@ public class OutputStreamI implements OutputStream } public + OutputStreamI(Communicator communicator, EncodingVersion v) + { + _communicator = communicator; + IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + _os = new IceInternal.BasicStream(instance, v, true, false); + _os.closure(this); + } + + public OutputStreamI(Communicator communicator, IceInternal.BasicStream os) { _communicator = communicator; diff --git a/java/src/Ice/Util.java b/java/src/Ice/Util.java index 822e8559efc..328aee186fa 100644 --- a/java/src/Ice/Util.java +++ b/java/src/Ice/Util.java @@ -430,7 +430,8 @@ public final class Util } /** - * Creates an input stream for dynamic invocation and dispatch. + * Creates an input stream for dynamic invocation and dispatch. The stream uses + * the communicator's default encoding version. * * @param communicator The communicator for the stream. * @param bytes An encoded request or reply. @@ -443,7 +444,23 @@ public final class Util } /** - * Creates an output stream for dynamic invocation and dispatch. + * Creates an input stream for dynamic invocation and dispatch. The stream uses + * the given encoding version. + * + * @param communicator The communicator for the stream. + * @param bytes An encoded request or reply. + * @param v The desired encoding version. + * @return The input stream. + **/ + public static InputStream + createInputStream(Communicator communicator, byte[] bytes, EncodingVersion v) + { + return new InputStreamI(communicator, bytes, v); + } + + /** + * Creates an output stream for dynamic invocation and dispatch. The stream uses + * the communicator's default encoding version. * * @param communicator The communicator for the stream. * @return The output stream. @@ -455,6 +472,20 @@ public final class Util } /** + * Creates an output stream for dynamic invocation and dispatch. The stream uses + * the given encoding version. + * + * @param communicator The communicator for the stream. + * @param v The desired encoding version. + * @return The output stream. + **/ + public static OutputStream + createOutputStream(Communicator communicator, EncodingVersion v) + { + return new OutputStreamI(communicator, v); + } + + /** * Returns the process-wide logger. * * @return The process-wide logger. |