diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-04-20 17:29:10 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-04-20 17:29:10 +0200 |
commit | 410311ac0dad54bbc0906085134b41e12ed44abb (patch) | |
tree | 678d75e04b90c289628c1ae79100317432bfe1d8 /java/src/IceInternal/Outgoing.java | |
parent | Enabled again objects test (diff) | |
download | ice-410311ac0dad54bbc0906085134b41e12ed44abb.tar.bz2 ice-410311ac0dad54bbc0906085134b41e12ed44abb.tar.xz ice-410311ac0dad54bbc0906085134b41e12ed44abb.zip |
Java port
Diffstat (limited to 'java/src/IceInternal/Outgoing.java')
-rw-r--r-- | java/src/IceInternal/Outgoing.java | 86 |
1 files changed, 72 insertions, 14 deletions
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index c8b2e0e6258..500f8217230 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -18,10 +18,11 @@ public final class Outgoing implements OutgoingMessageCallback _state = StateUnsent; _sent = false; _handler = handler; + _encoding = handler.getReference().getEncoding(); Instance instance = _handler.getReference().getInstance(); - _is = new BasicStream(instance); - _os = new BasicStream(instance); + //_is = new BasicStream(instance, Protocol.currentProtocolEncoding); + _os = new BasicStream(instance, Protocol.currentProtocolEncoding); writeHeader(operation, mode, context); } @@ -37,6 +38,7 @@ public final class Outgoing implements OutgoingMessageCallback _exception = null; _sent = false; _handler = handler; + _encoding = handler.getReference().getEncoding(); writeHeader(operation, mode, context); } @@ -44,7 +46,10 @@ public final class Outgoing implements OutgoingMessageCallback public void reclaim() { - _is.reset(); + if(_is != null) + { + _is.reset(); + } _os.reset(); } @@ -55,8 +60,6 @@ public final class Outgoing implements OutgoingMessageCallback { assert(_state == StateUnsent); - _os.endWriteEncaps(); - switch(_handler.getReference().getMode()) { case Reference.ModeTwoway: @@ -285,6 +288,10 @@ public final class Outgoing implements OutgoingMessageCallback assert(_state <= StateInProgress); + if(_is == null) + { + _is = new IceInternal.BasicStream(_handler.getReference().getInstance(), Protocol.currentProtocolEncoding); + } _is.swap(is); byte replyStatus = _is.readByte(); @@ -422,17 +429,74 @@ public final class Outgoing implements OutgoingMessageCallback } public BasicStream - is() + os() + { + return _os; + } + + public BasicStream + startReadParams() { + _is.startReadEncaps(); return _is; } + public void + endReadParams() + { + _is.endReadEncaps(); + } + + public void + readEmptyParams() + { + _is.skipEmptyEncaps(null); + } + + public byte[] + readParamEncaps() + { + return _is.readEncaps(null); + } + public BasicStream - os() + startWriteParams() { + _os.startWriteEncaps(_encoding); return _os; } + public void + endWriteParams() + { + _os.endWriteEncaps(); + } + + public void + writeEmptyParams() + { + _os.writeEmptyEncaps(_encoding); + } + + public void + writeParamEncaps(byte[] encaps) + { + if(encaps.length == 0) + { + _os.writeEmptyEncaps(_encoding); + } + else + { + _os.writeEncaps(encaps); + } + } + + public boolean + hasResponse() + { + return !_is.isEmpty(); + } + public void throwUserException() throws Ice.UserException @@ -517,13 +581,6 @@ public final class Outgoing implements OutgoingMessageCallback implicitContext.write(prxContext, _os); } } - - // - // Input and output parameters are always sent in an - // encapsulation, which makes it possible to forward requests as - // blobs. - // - _os.startWriteEncaps(); } catch(Ice.LocalException ex) { @@ -532,6 +589,7 @@ public final class Outgoing implements OutgoingMessageCallback } private RequestHandler _handler; + private Ice.EncodingVersion _encoding; private BasicStream _is; private BasicStream _os; private boolean _sent; |