diff options
| author | Robert Greig <rgreig@apache.org> | 2007-02-26 17:46:07 +0000 |
|---|---|---|
| committer | Robert Greig <rgreig@apache.org> | 2007-02-26 17:46:07 +0000 |
| commit | a019367dc582d61fa3739f385592c0baf9b972b8 (patch) | |
| tree | 5ce170123120f788d07d472e2febf6b32f17dc29 /qpid/dotnet/Qpid.Codec | |
| parent | 2e9743ac06fc05609155769bf04f4fa442d848c2 (diff) | |
| download | qpid-python-a019367dc582d61fa3739f385592c0baf9b972b8.tar.gz | |
(Patch submitted by Tomas Restrepo) QPID-ByteBuffer.diff.
Completely refactors the byte buffer implementation, doing away with a complex inheritance hierarchy.
Fixes reading and writing of field table to permit interop with Java client.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@511923 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Codec')
| -rw-r--r-- | qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs | 22 | ||||
| -rw-r--r-- | qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs | 13 |
2 files changed, 18 insertions, 17 deletions
diff --git a/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs b/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs index 21614cf108..72c56e0b17 100644 --- a/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs +++ b/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs @@ -33,8 +33,8 @@ namespace Qpid.Codec /// </summary> protected CumulativeProtocolDecoder() { - _remaining = ByteBuffer.allocate(4096); - _remaining.setAutoExpand(true); + _remaining = ByteBuffer.Allocate(4096); + _remaining.IsAutoExpand = true; } /// <summary> @@ -48,7 +48,7 @@ namespace Qpid.Codec /// </exception> public void Decode(ByteBuffer input, IProtocolDecoderOutput output) { - if (_remaining.position() != 0) // If there were remaining undecoded bytes + if (_remaining.Position != 0) // If there were remaining undecoded bytes { DecodeRemainingAndInput(input, output); } @@ -67,9 +67,9 @@ namespace Qpid.Codec } finally { - if (input.hasRemaining()) + if (input.HasRemaining) { - _remaining.put(input); + _remaining.Put(input); } } } @@ -77,8 +77,8 @@ namespace Qpid.Codec private void DecodeRemainingAndInput(ByteBuffer input, IProtocolDecoderOutput output) { // Concatenate input buffer with left-over bytes. - _remaining.put(input); - _remaining.flip(); + _remaining.Put(input); + _remaining.Flip(); try { @@ -86,7 +86,7 @@ namespace Qpid.Codec } finally { - _remaining.compact(); + _remaining.Compact(); } } @@ -94,17 +94,17 @@ namespace Qpid.Codec { for (;;) { - int oldPos = buf.position(); + int oldPos = buf.Position; bool decoded = DoDecode(buf, output); if (decoded) { - if (buf.position() == oldPos) + if (buf.Position == oldPos) { throw new Exception( "doDecode() can't return true when buffer is not consumed."); } - if (!buf.hasRemaining()) + if (!buf.HasRemaining) { break; } diff --git a/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs b/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs index 6577909cff..27095bd32d 100644 --- a/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs +++ b/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs @@ -217,8 +217,8 @@ namespace Qpid.Codec.Demux for (int i = decoders.Length - 1; i >= 0; i --) { IMessageDecoder decoder = decoders[i]; - int limit = input.limit(); - int pos = input.position(); + int limit = input.Limit; + int pos = input.Position; try { @@ -226,8 +226,8 @@ namespace Qpid.Codec.Demux } finally { - input.position(pos); - input.limit(limit); + input.Position = pos; + input.Limit = limit; } if (result == MessageDecoderResult.OK) @@ -248,9 +248,9 @@ namespace Qpid.Codec.Demux if (undecodables == _decoders.Length) { // Throw an exception if all decoders cannot decode data. - input.position(input.limit()); // Skip data + input.Position = input.Limit; // Skip data throw new ProtocolDecoderException( - "No appropriate message decoder: " + input.HexDump); + "No appropriate message decoder: " + input.GetHexDump()); } if (_currentDecoder == null) @@ -383,3 +383,4 @@ namespace Qpid.Codec.Demux } } + |
