You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2007/02/26 18:46:12 UTC
svn commit: r511923 [3/4] - in /incubator/qpid/trunk/qpid/dotnet: ./
Qpid.Buffer.Tests/ Qpid.Buffer.Tests/Properties/ Qpid.Buffer/
Qpid.Client.Tests/ Qpid.Client/ Qpid.Client/Client/
Qpid.Client/Client/Message/ Qpid.Client/Client/Transport/Socket/Block...
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/ByteBufferHexDumper.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/ByteBufferHexDumper.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/ByteBufferHexDumper.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/ByteBufferHexDumper.cs Mon Feb 26 09:46:07 2007
@@ -49,7 +49,7 @@
public static string GetHexDump(ByteBuffer input)
{
- int size = input.limit() - input.position();
+ int size = input.Remaining;
if (size == 0)
{
return "empty";
@@ -57,7 +57,7 @@
StringBuilder output = new StringBuilder(size * 3 - 1);
- byte[] data = input.array();
+ byte[] data = input.Array;
int byteValue = data[0] & 0xFF;
output.Append((char) highDigits[byteValue]);
output.Append((char) lowDigits[byteValue]);
@@ -74,4 +74,5 @@
}
}
}
+
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs Mon Feb 26 09:46:07 2007
@@ -19,32 +19,31 @@
*
*/
+using System;
+
namespace Qpid.Buffer
{
/// <summary>
/// Allocates <see cref="ByteBuffer"/>'s and manages them. Please
/// implement this interface if you need more advanced memory management scheme
/// </summary>
- public interface IByteBufferAllocator
+ public interface IByteBufferAllocator : IDisposable
{
/// <summary>
/// Returns the buffer which is capable of the specified size.
/// </summary>
/// <param name="capacity">The capacity of the buffer</param>
- /// <param name="direct">true to get a direct buffer, false to get a heap buffer</param>
- ByteBuffer Allocate(int capacity, bool direct);
+ /// <returns>A new buffer</returns>
+ ByteBuffer Allocate(int capacity);
/// <summary>
- /// Wraps the specified buffer
+ /// Wrap the specified byte array in a new buffer
/// </summary>
- /// <param name="nioBuffer">fixed byte buffer</param>
- /// <returns>The wrapped buffer</returns>
- ByteBuffer Wrap(FixedByteBuffer nioBuffer);
+ /// <param name="src">Source array</param>
+ /// <returns>A new buffer</returns>
+ ByteBuffer Wrap(byte[] src);
+
+ } // interface IByteBufferAllocator
+}
- /// <summary>
- /// Dispose of this allocator.
- /// </summary>
- void Dispose();
- }
-}
\ No newline at end of file
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj Mon Feb 26 09:46:07 2007
@@ -38,18 +38,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="BaseByteBuffer.cs" />
- <Compile Include="BufferDataException.cs" />
<Compile Include="BufferOverflowException.cs" />
<Compile Include="BufferUnderflowException.cs" />
<Compile Include="ByteBuffer.cs" />
<Compile Include="ByteBufferHexDumper.cs" />
- <Compile Include="ByteBufferProxy.cs" />
- <Compile Include="FixedByteBuffer.cs" />
- <Compile Include="HeapByteBuffer.cs" />
<Compile Include="IByteBufferAllocator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SimpleByteBuffer.cs" />
<Compile Include="SimpleByteBufferAllocator.cs" />
+ <Compile Include="SlicedByteBuffer.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Added: incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBuffer.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBuffer.cs?view=auto&rev=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBuffer.cs (added)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBuffer.cs Mon Feb 26 09:46:07 2007
@@ -0,0 +1,120 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+using System;
+
+namespace Qpid.Buffer
+{
+ internal sealed class SimpleByteBuffer : ByteBuffer
+ {
+ private byte[] _buffer;
+
+ public override int Capacity
+ {
+ get { return _buffer.Length; }
+ }
+
+ public override byte[] Array
+ {
+ get { return _buffer; }
+ }
+
+ /// <summary>
+ /// Initialize a new instance with the desired size
+ /// </summary>
+ /// <param name="desiredSize">Initial Length of the array</param>
+ internal SimpleByteBuffer(int desiredSize)
+ {
+ _buffer = new byte[desiredSize];
+ Position = 0;
+ Limit = Capacity;
+ }
+
+ /// <summary>
+ /// Initialize a new instance with the data from
+ /// an underlying array
+ /// </summary>
+ /// <param name="buffer">Initial data</param>
+ /// <remarks>The original array is copied during construction and is not modified</remarks>
+ internal SimpleByteBuffer(byte[] buffer)
+ {
+ _buffer = (byte[])buffer.Clone();
+ // position at end
+ Position = Limit = Capacity;
+ }
+
+ protected override void DoWrite(int position, byte value)
+ {
+ // available space is already handled by base class
+ _buffer[position] = value;
+ }
+
+ protected override void DoWrite(int position, byte[] src, int offset, int length)
+ {
+ // available space is already handled by base class
+ for ( int i = 0; i < length; i++ )
+ {
+ _buffer[position+i] = src[offset+i];
+ }
+ }
+
+ protected override byte DoReadByte(int position)
+ {
+ return _buffer[position];
+ }
+
+ protected override void DoReadBytes(int position, byte[] dest, int offset, int length)
+ {
+ System.Array.Copy(_buffer, position, dest, offset, length);
+ }
+
+ protected override void DoCompact()
+ {
+ if ( Remaining > 0 )
+ {
+ if ( Position > 0 )
+ {
+ System.Array.Copy(_buffer, Position, _buffer, 0, Remaining);
+ }
+ Position = Remaining;
+ } else
+ {
+ Position = 0;
+ }
+ Limit = Capacity;
+ }
+
+ protected override void DoResize(int newSize)
+ {
+ if ( newSize < Capacity )
+ throw new NotSupportedException("Cannot resize a buffer to make it smaller");
+
+ int newCapacity = 1;
+ while ( newCapacity < newSize )
+ {
+ newCapacity <<= 1;
+ }
+
+ byte[] newBuffer = new byte[newCapacity];
+ System.Array.Copy(_buffer, newBuffer, _buffer.Length);
+ _buffer = newBuffer;
+ }
+ } // class SimpleByteBuffer
+}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs Mon Feb 26 09:46:07 2007
@@ -18,171 +18,40 @@
* under the License.
*
*/
-using System;
-using System.Runtime.CompilerServices;
namespace Qpid.Buffer
{
- /// <summary>
- /// A simplistic <see cref="ByteBufferAllocator"/> which simply allocates a new
- /// buffer every time
- /// </summary>
- public class SimpleByteBufferAllocator : IByteBufferAllocator
- {
- private const int MINIMUM_CAPACITY = 1;
-
- public SimpleByteBufferAllocator()
- {
- }
-
- public ByteBuffer Allocate( int capacity, bool direct )
- {
- FixedByteBuffer nioBuffer;
- if( direct )
- {
- nioBuffer = FixedByteBuffer.allocateDirect( capacity );
- }
- else
- {
- nioBuffer = FixedByteBuffer.allocate( capacity );
- }
- return new SimpleByteBuffer( nioBuffer );
- }
-
- public ByteBuffer Wrap( FixedByteBuffer nioBuffer )
- {
- return new SimpleByteBuffer( nioBuffer );
- }
-
- public void Dispose()
- {
- }
-
- private class SimpleByteBuffer : BaseByteBuffer
- {
- private FixedByteBuffer _buf;
- private int refCount = 1;
-
- internal SimpleByteBuffer( FixedByteBuffer buf )
- {
- this._buf = buf;
- buf.order( ByteOrder.BigEndian );
- refCount = 1;
- }
-
- [MethodImpl(MethodImplOptions.Synchronized)]
- public override void acquire()
- {
- if( refCount <= 0 )
- {
- throw new InvalidOperationException("Already released buffer.");
- }
-
- refCount ++;
- }
-
- public override void release()
- {
- lock( this )
- {
- if( refCount <= 0 )
- {
- refCount = 0;
- throw new InvalidOperationException(
- "Already released buffer. You released the buffer too many times." );
- }
-
- refCount --;
- if( refCount > 0)
- {
- return;
- }
- }
- }
-
- public override FixedByteBuffer buf()
- {
- return _buf;
- }
-
- public override bool isPooled()
- {
- return false;
- }
-
- public override void setPooled(bool pooled)
- {
- }
-
- protected override void capacity0(int requestedCapacity)
- {
- int newCapacity = MINIMUM_CAPACITY;
- while( newCapacity < requestedCapacity )
- {
- newCapacity <<= 1;
- }
-
- FixedByteBuffer oldBuf = this._buf;
- FixedByteBuffer newBuf;
- if( isDirect() )
- {
- newBuf = FixedByteBuffer.allocateDirect( newCapacity );
- }
- else
- {
- newBuf = FixedByteBuffer.allocate( newCapacity );
- }
-
- newBuf.clear();
- oldBuf.clear();
- newBuf.put( oldBuf );
- this._buf = newBuf;
- }
-
- public override ByteBuffer duplicate() {
- return new SimpleByteBuffer( this._buf.duplicate() );
- }
-
- public override ByteBuffer slice()
- {
- return new SimpleByteBuffer( this._buf.slice() );
- }
-
- public override ByteBuffer asReadOnlyBuffer()
- {
- return new SimpleByteBuffer( this._buf.asReadOnlyBuffer() );
- }
-
- public override byte[] array()
- {
- return _buf.array();
- }
-
- public override int arrayOffset()
- {
- return _buf.arrayOffset();
- }
-
- public override void put(ushort value)
- {
- _buf.put(value);
- }
-
- public override void put(uint max)
- {
- _buf.put(max);
- }
-
- public override void put(ulong tag)
- {
- _buf.put(tag);
- }
-
- public override ulong GetUnsignedLong()
- {
- return _buf.getUnsignedLong();
- }
+ /// <summary>
+ /// Allocates <see cref="ByteBuffer"/>'s and manages them.
+ /// This is a simple implementation that just returns buffers
+ /// as they are. Buffers are not reused or refcounted
+ /// </summary>
+ public class SimpleByteBufferAllocator : IByteBufferAllocator
+ {
+ #region IByteBufferAllocator Members
+
+ public ByteBuffer Allocate(int capacity)
+ {
+ return new SimpleByteBuffer(capacity);
+ }
+
+ public ByteBuffer Wrap(byte[] src)
+ {
+ return new SimpleByteBuffer(src);
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ public void Dispose()
+ {
+ // no need to do anaything
+ }
- }
- }
+ #endregion
+
+ } // class SimpleByteBufferAllocator
}
+
+
Added: incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SlicedByteBuffer.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SlicedByteBuffer.cs?view=auto&rev=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SlicedByteBuffer.cs (added)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Buffer/SlicedByteBuffer.cs Mon Feb 26 09:46:07 2007
@@ -0,0 +1,86 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+using System;
+
+namespace Qpid.Buffer
+{
+ internal sealed class SlicedByteBuffer : ByteBuffer
+ {
+ private ByteBuffer _buffer;
+ private int _capacity;
+ private int _startPos;
+
+ public override int Capacity
+ {
+ get { return _capacity; }
+ }
+
+ public override byte[] Array
+ {
+ get { return _buffer.Array; }
+ }
+
+ /// <summary>
+ /// Initialize a new instance
+ /// </summary>
+ /// <param name="buffer">Underlying byte buffer</param>
+ internal SlicedByteBuffer(ByteBuffer buffer)
+ {
+ _buffer = buffer;
+ _startPos = buffer.Position;
+ Position = 0;
+ _capacity = buffer.Remaining;
+ Limit = Capacity;
+ // cannot autoexpand
+ IsAutoExpand = false;
+ }
+
+ protected override void DoWrite(int position, byte value)
+ {
+ _buffer.Put(_startPos + position, value);
+ }
+
+ protected override void DoWrite(int position, byte[] src, int offset, int length)
+ {
+ _buffer.Put(_startPos + position, src, offset, length);
+ }
+
+ protected override byte DoReadByte(int position)
+ {
+ return _buffer.GetByte(_startPos + position);
+ }
+
+ protected override void DoReadBytes(int position, byte[] dest, int offset, int length)
+ {
+ _buffer.GetBytes(_startPos + position, dest, offset, length);
+ }
+
+ protected override void DoCompact()
+ {
+ throw new NotSupportedException();
+ }
+
+ protected override void DoResize(int newSize)
+ {
+ throw new NotSupportedException();
+ }
+ } // class SlicedByteBuffer
+}
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -1,2 +1,3 @@
*.pidb
bin
+obj
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -1,2 +1,3 @@
*.pidb
bin
+obj
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/AmqChannel.cs Mon Feb 26 09:46:07 2007
@@ -815,8 +815,8 @@
byte[] payload = null;
if (buf != null)
{
- payload = new byte[buf.remaining()];
- buf.get(payload);
+ payload = new byte[buf.Remaining];
+ buf.GetBytes(payload);
}
BasicContentHeaderProperties contentHeaderProperties = message.ContentHeaderProperties;
@@ -824,7 +824,7 @@
{
if (!disableTimestamps)
{
- contentHeaderProperties.Expiration = (uint)currentTime + timeToLive;
+ contentHeaderProperties.Expiration = currentTime + timeToLive;
}
}
else
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AMQMessageFactory.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AMQMessageFactory.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AMQMessageFactory.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AMQMessageFactory.cs Mon Feb 26 09:46:07 2007
@@ -43,20 +43,20 @@
if (bodies != null && bodies.Count == 1)
{
_logger.Debug("Non-fragmented message body (bodySize=" + contentHeader.BodySize +")");
- data = ByteBuffer.wrap(((ContentBody)bodies[0]).Payload);
+ data = ByteBuffer.Wrap(((ContentBody)bodies[0]).Payload);
}
else
{
_logger.Debug("Fragmented message body (" + bodies.Count + " frames, bodySize=" + contentHeader.BodySize + ")");
- data = ByteBuffer.allocate((int)contentHeader.BodySize); // XXX: Is cast a problem?
+ data = ByteBuffer.Allocate((int)contentHeader.BodySize); // XXX: Is cast a problem?
foreach (ContentBody body in bodies) {
- data.put(body.Payload);
+ data.Put(body.Payload);
//body.Payload.Release();
}
- data.flip();
+ data.Flip();
}
- _logger.Debug("Creating message from buffer with position=" + data.position() + " and remaining=" + data.remaining());
+ _logger.Debug("Creating message from buffer with position=" + data.Position + " and remaining=" + data.Remaining);
return CreateMessage(messageNbr, data, contentHeader);
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs Mon Feb 26 09:46:07 2007
@@ -36,33 +36,38 @@
protected ByteBuffer _data;
protected bool _readableMessage = false;
+ private QpidHeaders _headers;
#region new_java_ctrs
protected AbstractQmsMessage(ByteBuffer data)
: base(new BasicContentHeaderProperties())
{
- _data = data;
- if (_data != null)
- {
- _data.acquire();
- }
- _readableMessage = (data != null);
+ Init(data);
}
protected AbstractQmsMessage(long deliveryTag, BasicContentHeaderProperties contentHeader, ByteBuffer data)
: this(contentHeader, deliveryTag)
{
- _data = data;
- if (_data != null)
- {
- _data.acquire();
- }
- _readableMessage = data != null;
+ Init(data);
}
protected AbstractQmsMessage(BasicContentHeaderProperties contentHeader, long deliveryTag) : base(contentHeader, deliveryTag)
{
+ Init(null);
+ }
+
+ private void Init(ByteBuffer data)
+ {
+ _data = data;
+ if ( _data != null )
+ {
+ _data.Acquire();
+ }
+ _readableMessage = (data != null);
+ if ( ContentHeaderProperties.Headers == null )
+ ContentHeaderProperties.Headers = new FieldTable();
+ _headers = new QpidHeaders(ContentHeaderProperties.Headers);
}
#endregion
@@ -269,7 +274,7 @@
}
set
{
- ContentHeaderProperties.Expiration = (uint) value;
+ ContentHeaderProperties.Expiration = value;
}
}
@@ -314,7 +319,7 @@
public IHeaders Headers
{
- get { return new QpidHeaders(this); }
+ get { return _headers; }
}
public abstract void ClearBodyImpl();
@@ -345,13 +350,13 @@
{
if (!_readableMessage)
{
- _data.flip();
+ _data.Flip();
}
else
{
// Make sure we rewind the data just in case any method has moved the
// position beyond the start.
- _data.rewind();
+ _data.Rewind();
}
}
return _data;
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs Mon Feb 26 09:46:07 2007
@@ -62,8 +62,8 @@
ContentHeaderProperties.ContentType = MIME_TYPE;
if (data == null)
{
- _data = ByteBuffer.allocate(DEFAULT_BUFFER_INITIAL_SIZE);
- _data.setAutoExpand(true);
+ _data = ByteBuffer.Allocate(DEFAULT_BUFFER_INITIAL_SIZE);
+ _data.IsAutoExpand = true;
}
}
@@ -76,7 +76,7 @@
public override void ClearBodyImpl()
{
- _data.clear();
+ _data.Clear();
}
public override string ToBodyString()
@@ -99,19 +99,19 @@
{
return null;
}
- int pos = _data.position();
- _data.rewind();
+ int pos = _data.Position;
+ _data.Rewind();
// one byte left is for the end of frame marker
- if (_data.remaining() == 0)
+ if (_data.Remaining == 0)
{
// this is really redundant since pos must be zero
- _data.position(pos);
+ _data.Position = pos;
return null;
}
else
{
- byte[] data = new byte[_data.remaining()];
- _data.get(data);
+ byte[] data = new byte[_data.Remaining];
+ _data.GetBytes(data);
return Encoding.UTF8.GetString(data);
}
}
@@ -129,7 +129,7 @@
get
{
CheckReadable();
- return _data.limit();
+ return _data.Limit;
}
}
@@ -145,63 +145,63 @@
{
CheckReadable();
CheckAvailable(1);
- return _data.get() != 0;
+ return _data.GetByte() != 0;
}
public byte ReadByte()
{
CheckReadable();
CheckAvailable(1);
- return _data.get();
+ return _data.GetByte();
}
public short ReadSignedByte()
{
CheckReadable();
CheckAvailable(1);
- return _data.get();
+ return _data.GetSByte();
}
public short ReadShort()
{
CheckReadable();
CheckAvailable(2);
- return _data.getShort();
+ return _data.GetInt16();
}
public char ReadChar()
{
CheckReadable();
CheckAvailable(2);
- return _data.getChar();
+ return _data.GetChar();
}
public int ReadInt()
{
CheckReadable();
CheckAvailable(4);
- return _data.getInt();
+ return _data.GetInt32();
}
public long ReadLong()
{
CheckReadable();
CheckAvailable(8);
- return _data.getLong();
+ return _data.GetInt64();
}
public float ReadFloat()
{
CheckReadable();
CheckAvailable(4);
- return _data.getFloat();
+ return _data.GetFloat();
}
public double ReadDouble()
{
CheckReadable();
CheckAvailable(8);
- return _data.getDouble();
+ return _data.GetDouble();
}
public string ReadUTF()
@@ -212,8 +212,8 @@
CheckAvailable(1);
try
{
- byte[] data = new byte[_data.remaining()];
- _data.get(data);
+ byte[] data = new byte[_data.Remaining];
+ _data.GetBytes(data);
return Encoding.UTF8.GetString(data);
}
catch (IOException e)
@@ -229,14 +229,14 @@
throw new ArgumentNullException("bytes");
}
CheckReadable();
- int count = (_data.remaining() >= bytes.Length ? bytes.Length : _data.remaining());
+ int count = (_data.Remaining >= bytes.Length ? bytes.Length : _data.Remaining);
if (count == 0)
{
return -1;
}
else
{
- _data.get(bytes, 0, count);
+ _data.GetBytes(bytes, 0, count);
return count;
}
}
@@ -252,14 +252,14 @@
throw new ArgumentOutOfRangeException("maxLength must be >= 0");
}
CheckReadable();
- int count = (_data.remaining() >= maxLength ? maxLength : _data.remaining());
+ int count = (_data.Remaining >= maxLength ? maxLength : _data.Remaining);
if (count == 0)
{
return -1;
}
else
{
- _data.get(bytes, 0, count);
+ _data.GetBytes(bytes, 0, count);
return count;
}
}
@@ -267,80 +267,80 @@
public void WriteBoolean(bool b)
{
CheckWritable();
- _data.put(b ? (byte)1 : (byte)0);
+ _data.Put(b ? (byte)1 : (byte)0);
}
public void WriteByte(byte b)
{
CheckWritable();
- _data.put(b);
+ _data.Put(b);
}
public void WriteShort(short i)
{
CheckWritable();
- _data.putShort(i);
+ _data.Put(i);
}
public void WriteChar(char c)
{
CheckWritable();
- _data.putChar(c);
+ _data.Put(c);
}
public void WriteSignedByte(short value)
{
CheckWritable();
- _data.put((byte)value);
+ _data.Put(value);
}
public void WriteDouble(double value)
{
CheckWritable();
- _data.putDouble(value);
+ _data.Put(value);
}
public void WriteFloat(float value)
{
CheckWritable();
- _data.putFloat(value);
+ _data.Put(value);
}
public void WriteInt(int value)
{
CheckWritable();
- _data.putInt(value);
+ _data.Put(value);
}
public void WriteLong(long value)
{
CheckWritable();
- _data.putLong(value);
+ _data.Put(value);
}
public void WriteUTF(string value)
{
CheckWritable();
byte[] encodedData = Encoding.UTF8.GetBytes(value);
- _data.put(encodedData);
+ _data.Put(encodedData);
}
public void WriteBytes(byte[] bytes)
{
CheckWritable();
- _data.put(bytes);
+ _data.Put(bytes);
}
public void WriteBytes(byte[] bytes, int offset, int length)
{
CheckWritable();
- _data.put(bytes, offset, length);
+ _data.Put(bytes, offset, length);
}
protected override void Reset()
{
base.Reset();
- _data.flip();
+ _data.Flip();
}
void IBytesMessage.Reset()
@@ -356,7 +356,7 @@
*/
private void CheckAvailable(int len)
{
- if (_data.remaining() < len)
+ if (_data.Remaining < len)
{
throw new MessageEOFException("Unable to read " + len + " bytes");
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidHeaders.cs Mon Feb 26 09:46:07 2007
@@ -6,351 +6,202 @@
namespace Qpid.Client.Message
{
- internal class QpidHeaders : IHeaders
- {
- public const char BOOLEAN_PROPERTY_PREFIX = 'B';
- public const char BYTE_PROPERTY_PREFIX = 'b';
- public const char SHORT_PROPERTY_PREFIX = 's';
- public const char INT_PROPERTY_PREFIX = 'i';
- public const char LONG_PROPERTY_PREFIX = 'l';
- public const char FLOAT_PROPERTY_PREFIX = 'f';
- public const char DOUBLE_PROPERTY_PREFIX = 'd';
- public const char STRING_PROPERTY_PREFIX = 'S';
-
- AbstractQmsMessage _message;
-
- public QpidHeaders(AbstractQmsMessage message)
- {
- _message = message;
- }
-
- public bool Contains(string name)
- {
- CheckPropertyName(name);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return false;
- }
- else
- {
- // TODO: fix this
- return _message.ContentHeaderProperties.Headers.Contains(STRING_PROPERTY_PREFIX + name);
- }
- }
-
- public void Clear()
- {
- if (_message.ContentHeaderProperties.Headers != null)
- {
- _message.ContentHeaderProperties.Headers.Clear();
- }
- }
-
- public string this[string name]
- {
- get
- {
- return GetString(name);
- }
- set
- {
- SetString(name, value);
- }
- }
-
- public bool GetBoolean(string name)
- {
- CheckPropertyName(name);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return false;
- }
- else
- {
- object b = _message.ContentHeaderProperties.Headers[BOOLEAN_PROPERTY_PREFIX + name];
-
- if (b == null)
- {
- return false;
- }
- else
- {
- return (bool)b;
- }
- }
- }
-
- public void SetBoolean(string name, bool b)
- {
- CheckPropertyName(name);
- _message.ContentHeaderProperties.Headers[BOOLEAN_PROPERTY_PREFIX + name] = b;
- }
-
- public byte GetByte(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object b = _message.ContentHeaderProperties.Headers[BYTE_PROPERTY_PREFIX + propertyName];
- if (b == null)
- {
- return 0;
- }
- else
- {
- return (byte)b;
- }
- }
- }
-
- public void SetByte(string propertyName, byte b)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[BYTE_PROPERTY_PREFIX + propertyName] = b;
- }
-
- public short GetShort(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object s = _message.ContentHeaderProperties.Headers[SHORT_PROPERTY_PREFIX + propertyName];
- if (s == null)
- {
- return 0;
- }
- else
- {
- return (short)s;
- }
- }
- }
-
- public void SetShort(string propertyName, short i)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[SHORT_PROPERTY_PREFIX + propertyName] = i;
- }
-
- public int GetInt(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object i = _message.ContentHeaderProperties.Headers[INT_PROPERTY_PREFIX + propertyName];
- if (i == null)
- {
- return 0;
- }
- else
- {
- return (int)i;
- }
- }
- }
-
- public void SetInt(string propertyName, int i)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[INT_PROPERTY_PREFIX + propertyName] = i;
- }
-
- public long GetLong(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object l = _message.ContentHeaderProperties.Headers[LONG_PROPERTY_PREFIX + propertyName];
- if (l == null)
- {
- // temp - the spec says do this but this throws a NumberFormatException
- //return Long.valueOf(null).longValue();
- return 0;
- }
- else
- {
- return (long)l;
- }
- }
- }
-
- public void SetLong(string propertyName, long l)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[LONG_PROPERTY_PREFIX + propertyName] = l;
- }
-
- public float GetFloat(String propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object f = _message.ContentHeaderProperties.Headers[FLOAT_PROPERTY_PREFIX + propertyName];
- if (f == null)
- {
- return 0;
- }
- else
- {
- return (float)f;
- }
- }
- }
-
- public void SetFloat(string propertyName, float f)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[FLOAT_PROPERTY_PREFIX + propertyName] = f;
- }
-
- public double GetDouble(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return 0;
- }
- else
- {
- object d = _message.ContentHeaderProperties.Headers[DOUBLE_PROPERTY_PREFIX + propertyName];
- if (d == null)
- {
- return 0;
- }
- else
- {
- return (double)d;
- }
- }
- }
-
- public void SetDouble(string propertyName, double v)
- {
- CheckPropertyName(propertyName);
- _message.ContentHeaderProperties.Headers[DOUBLE_PROPERTY_PREFIX + propertyName] = v;
- }
-
- public string GetString(string propertyName)
- {
- CheckPropertyName(propertyName);
- if (_message.ContentHeaderProperties.Headers == null)
- {
- return null;
- }
- else
- {
- return (string)_message.ContentHeaderProperties.Headers[STRING_PROPERTY_PREFIX + propertyName];
- }
- }
-
- public void SetString(string propertyName, string value)
- {
- CheckPropertyName(propertyName);
- CreatePropertyMapIfRequired();
- propertyName = STRING_PROPERTY_PREFIX + propertyName;
- _message.ContentHeaderProperties.Headers[propertyName] = value;
- }
-
- private void CheckPropertyName(string propertyName)
- {
- if (propertyName == null)
- {
- throw new ArgumentException("Property name must not be null");
- }
- else if ("".Equals(propertyName))
- {
- throw new ArgumentException("Property name must not be the empty string");
- }
-
- if (_message.ContentHeaderProperties.Headers == null)
- {
- _message.ContentHeaderProperties.Headers = new FieldTable();
- }
- }
-
- private void CreatePropertyMapIfRequired()
- {
- if (_message.ContentHeaderProperties.Headers == null)
- {
- _message.ContentHeaderProperties.Headers = new FieldTable();
- }
- }
-
- public override string ToString()
- {
- StringBuilder buf = new StringBuilder("{");
- int i = 0;
- foreach (DictionaryEntry entry in _message.ContentHeaderProperties.Headers)
- {
- ++i;
- if (i > 1)
- {
- buf.Append(", ");
- }
- string propertyName = (string)entry.Key;
- if (propertyName == null)
- {
- buf.Append("\nInternal error: Property with NULL key defined");
- }
- else
- {
- buf.Append(propertyName.Substring(1));
-
- buf.Append(" : ");
-
- char typeIdentifier = propertyName[0];
- buf.Append(typeIdentifierToName(typeIdentifier));
- buf.Append(" = ").Append(entry.Value);
- }
- }
- buf.Append("}");
- return buf.ToString();
- }
-
- private static string typeIdentifierToName(char typeIdentifier)
- {
- switch (typeIdentifier)
- {
- case BOOLEAN_PROPERTY_PREFIX:
- return "boolean";
- case BYTE_PROPERTY_PREFIX:
- return "byte";
- case SHORT_PROPERTY_PREFIX:
- return "short";
- case INT_PROPERTY_PREFIX:
- return "int";
- case LONG_PROPERTY_PREFIX:
- return "long";
- case FLOAT_PROPERTY_PREFIX:
- return "float";
- case DOUBLE_PROPERTY_PREFIX:
- return "double";
- case STRING_PROPERTY_PREFIX:
- return "string";
- default:
- return "unknown ( '" + typeIdentifier + "')";
- }
- }
+ internal class QpidHeaders : IHeaders
+ {
+ private FieldTable _headers;
+
+ public QpidHeaders(FieldTable headers)
+ {
+ if ( headers == null )
+ throw new ArgumentNullException("headers");
+ _headers = headers;
+ }
+
+ public bool Contains(string name)
+ {
+ CheckPropertyName(name);
+ return _headers.Contains(name);
+ }
+
+ public void Clear()
+ {
+ _headers.Clear();
+ }
+
+ public string this[string name]
+ {
+ get
+ {
+ return GetString(name);
+ }
+ set
+ {
+ SetString(name, value);
+ }
+ }
+
+ public bool GetBoolean(string name)
+ {
+ CheckPropertyName(name);
+ if ( Contains(name) )
+ return _headers.GetBoolean(name);
+ return false;
+ }
+
+ public void SetBoolean(string name, bool b)
+ {
+ CheckPropertyName(name);
+ _headers.SetBoolean(name, b);
+ }
+
+ public byte GetByte(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetByte(propertyName);
+ return 0;
+ }
+
+ public void SetByte(string propertyName, byte b)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetByte(propertyName, b);
+ }
+
+ // we have sbyte overloads to interoperate with java
+ // because the Java client/server uses signed bytes
+ // by default, while C#'s is unsigned
+ public sbyte GetSByte(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetSByte(propertyName);
+ return 0;
+ }
+
+ public void SetSByte(string propertyName, sbyte b)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetSByte(propertyName, b);
+ }
+
+ public short GetShort(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetInt16(propertyName);
+ return 0;
+ }
+
+ public void SetShort(string propertyName, short i)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetInt16(propertyName, i);
+ }
+
+ public int GetInt(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetInt32(propertyName);
+ return 0;
+ }
+
+ public void SetInt(string propertyName, int i)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetInt32(propertyName, i);
+ }
+
+ public long GetLong(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetInt64(propertyName);
+ return 0;
+ }
+
+ public void SetLong(string propertyName, long l)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetInt64(propertyName, l);
+ }
+
+ public float GetFloat(String propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetFloat(propertyName);
+ return 0f;
+ }
+
+ public void SetFloat(string propertyName, float f)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetFloat(propertyName, f);
+ }
+
+ public double GetDouble(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ if ( Contains(propertyName) )
+ return _headers.GetDouble(propertyName);
+ return 0;
+ }
+
+ public void SetDouble(string propertyName, double v)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetDouble(propertyName, v);
+ }
+
+ public string GetString(string propertyName)
+ {
+ CheckPropertyName(propertyName);
+ return _headers.GetString(propertyName);
+ }
+
+ public void SetString(string propertyName, string value)
+ {
+ CheckPropertyName(propertyName);
+ _headers.SetString(propertyName, value);
+ }
+
+ private static void CheckPropertyName(string propertyName)
+ {
+ if ( propertyName == null )
+ {
+ throw new ArgumentException("Property name must not be null");
+ } else if ( "".Equals(propertyName) )
+ {
+ throw new ArgumentException("Property name must not be the empty string");
+ }
+ }
+
+ public override string ToString()
+ {
+ StringBuilder buf = new StringBuilder("{");
+ int i = 0;
+ foreach ( DictionaryEntry entry in _headers )
+ {
+ ++i;
+ if ( i > 1 )
+ {
+ buf.Append(", ");
+ }
+ string propertyName = (string)entry.Key;
+ if ( propertyName == null )
+ {
+ buf.Append("\nInternal error: Property with NULL key defined");
+ } else
+ {
+ buf.Append(propertyName);
+ buf.Append(" = ").Append(entry.Value);
+ }
+ }
+ buf.Append("}");
+ return buf.ToString();
+ }
- }
-}
\ No newline at end of file
+ }
+}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs Mon Feb 26 09:46:07 2007
@@ -53,7 +53,7 @@
{
if (_data != null)
{
- _data.release();
+ _data.Release();
}
_data = null;
_decodedValue = null;
@@ -86,11 +86,11 @@
}
else
{
- _data.rewind();
+ _data.Rewind();
// Read remaining bytes.
- byte[] bytes = new byte[_data.remaining()];
- _data.get(bytes);
+ byte[] bytes = new byte[_data.Remaining];
+ _data.GetBytes(bytes);
// Convert to string based on encoding.
if (ContentHeaderProperties.Encoding != null)
@@ -118,7 +118,7 @@
// throw ArgumentException if the encoding is not supported
bytes = Encoding.GetEncoding(ContentHeaderProperties.Encoding).GetBytes(value);
}
- _data = ByteBuffer.wrap(bytes);
+ _data = ByteBuffer.Wrap(bytes);
_decodedValue = value;
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Transport/Socket/Blocking/BlockingSocketProcessor.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Transport/Socket/Blocking/BlockingSocketProcessor.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Transport/Socket/Blocking/BlockingSocketProcessor.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Client/Client/Transport/Socket/Blocking/BlockingSocketProcessor.cs Mon Feb 26 09:46:07 2007
@@ -71,7 +71,7 @@
{
try
{
- _networkStream.Write(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit()); // FIXME
+ _networkStream.Write(byteBuffer.Array, byteBuffer.Position, byteBuffer.Limit); // FIXME
}
catch (Exception e)
{
@@ -87,10 +87,10 @@
int numOctets = _networkStream.Read(bytes, 0, bytes.Length);
- ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
- byteBuffer.limit(numOctets);
+ ByteBuffer byteBuffer = ByteBuffer.Wrap(bytes);
+ byteBuffer.Limit = numOctets;
- byteBuffer.flip();
+ byteBuffer.Flip();
return byteBuffer;
}
@@ -113,4 +113,5 @@
}
}
}
+
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -1,2 +1,3 @@
*.pidb
bin
+obj
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/CumulativeProtocolDecoder.cs Mon Feb 26 09:46:07 2007
@@ -33,8 +33,8 @@
/// </summary>
protected CumulativeProtocolDecoder()
{
- _remaining = ByteBuffer.allocate(4096);
- _remaining.setAutoExpand(true);
+ _remaining = ByteBuffer.Allocate(4096);
+ _remaining.IsAutoExpand = true;
}
/// <summary>
@@ -48,7 +48,7 @@
/// </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 @@
}
finally
{
- if (input.hasRemaining())
+ if (input.HasRemaining)
{
- _remaining.put(input);
+ _remaining.Put(input);
}
}
}
@@ -77,8 +77,8 @@
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 @@
}
finally
{
- _remaining.compact();
+ _remaining.Compact();
}
}
@@ -94,17 +94,17 @@
{
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;
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Codec/Demux/DemuxingProtocolCodecFactory.cs Mon Feb 26 09:46:07 2007
@@ -217,8 +217,8 @@
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 @@
}
finally
{
- input.position(pos);
- input.limit(limit);
+ input.Position = pos;
+ input.Limit = limit;
}
if (result == MessageDecoderResult.OK)
@@ -248,9 +248,9 @@
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)
@@ -382,4 +382,5 @@
}
}
}
+
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -2,3 +2,4 @@
generated
Qpid.Common.pidb
bin
+obj
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid.Common.Tests.csproj
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid.Common.Tests.csproj?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid.Common.Tests.csproj (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid.Common.Tests.csproj Mon Feb 26 09:46:07 2007
@@ -40,6 +40,7 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Qpid\Collections\TestLinkedHashtable.cs" />
+ <Compile Include="Qpid\Framing\TestEncodingUtils.cs" />
<Compile Include="Qpid\Framing\TestAMQType.cs" />
</ItemGroup>
<ItemGroup>
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestAMQType.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestAMQType.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestAMQType.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestAMQType.cs Mon Feb 26 09:46:07 2007
@@ -34,12 +34,12 @@
public void LONG_STRING_ReadWrite()
{
AMQType type = AMQType.LONG_STRING;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const string VALUE = "simple string 1";
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
@@ -75,12 +75,12 @@
public void UINT32_ReadWrite()
{
AMQType type = AMQType.UINT32;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const uint VALUE = 0xFFEEDDCC;
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
@@ -113,11 +113,11 @@
public void VOID_ReadWrite()
{
AMQType type = AMQType.VOID;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
type.WriteToBuffer(null, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(null, value.Value);
}
@@ -152,11 +152,11 @@
public void BOOLEAN_ReadWrite()
{
AMQType type = AMQType.BOOLEAN;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
type.WriteToBuffer(true, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(true, value.Value);
}
@@ -167,24 +167,24 @@
public void INT16_ReadWrite()
{
AMQType type = AMQType.INT16;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const short VALUE = -32765;
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
//public void UINT16_ReadWrite()
//{
// AMQType type = AMQType.UINT16;
- // ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ // ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
// const ushort VALUE = 64321;
// type.WriteToBuffer(VALUE, buffer);
- // buffer.flip();
- // buffer.position(0);
+ // buffer.Flip();
+ // buffer.Rewind();
// AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
// Assert.AreEqual(VALUE, value.Value);
//}
@@ -195,12 +195,12 @@
public void INT32_ReadWrite()
{
AMQType type = AMQType.INT32;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const int VALUE = -39273563;
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
@@ -211,12 +211,12 @@
public void INT64_ReadWrite()
{
AMQType type = AMQType.INT64;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const long VALUE = -(2^43+1233123);
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
@@ -224,12 +224,12 @@
public void UINT64_ReadWrite()
{
AMQType type = AMQType.UINT64;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const ulong VALUE = (2 ^ 61 + 1233123);
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
@@ -240,12 +240,12 @@
public void FLOAT_ReadWrite()
{
AMQType type = AMQType.FLOAT;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const float VALUE = 1.2345000E-035f;
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
@@ -256,12 +256,12 @@
public void DOUBLE_ReadWrite()
{
AMQType type = AMQType.DOUBLE;
- ByteBuffer buffer = (new SimpleByteBufferAllocator()).Allocate(0x1000, false);
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
const double VALUE = 1.2345000E-045;
type.WriteToBuffer(VALUE, buffer);
- buffer.flip();
- buffer.position(0);
+ buffer.Flip();
+ buffer.Rewind();
AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
Assert.AreEqual(VALUE, value.Value);
}
Added: incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestEncodingUtils.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestEncodingUtils.cs?view=auto&rev=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestEncodingUtils.cs (added)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common.Tests/Qpid/Framing/TestEncodingUtils.cs Mon Feb 26 09:46:07 2007
@@ -0,0 +1,60 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+using System;
+using NUnit.Framework;
+using Qpid.Buffer;
+using Qpid.Framing;
+
+namespace Qpid.Framing.Tests
+{
+ [TestFixture]
+ public class TestEncodingUtils
+ {
+ [Test]
+ public void CanReadLongAsShortString()
+ {
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
+ EncodingUtils.WriteShortStringBytes(buffer, "98878122");
+ buffer.Flip();
+ long value = EncodingUtils.ReadLongAsShortString(buffer);
+ Assert.AreEqual(98878122, value);
+ }
+ [Test]
+ public void CanReadLongAsShortStringNegative()
+ {
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
+ EncodingUtils.WriteShortStringBytes(buffer, "-98878122");
+ buffer.Flip();
+ long value = EncodingUtils.ReadLongAsShortString(buffer);
+ Assert.AreEqual(-98878122, value);
+ }
+ [Test]
+ public void CanReadLongAsShortStringEmpty()
+ {
+ ByteBuffer buffer = ByteBuffer.Allocate(0x1000);
+ EncodingUtils.WriteShortStringBytes(buffer, "");
+ buffer.Flip();
+ long value = EncodingUtils.ReadLongAsShortString(buffer);
+ Assert.AreEqual(0, value);
+ }
+
+ }
+}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockDecoder.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockDecoder.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockDecoder.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockDecoder.cs Mon Feb 26 09:46:07 2007
@@ -51,11 +51,11 @@
}
// final +1 represents the command end which we know we must require even
// if there is an empty body
- if (input.remaining() < 1)
+ if (input.Remaining < 1)
{
return MessageDecoderResult.NEED_DATA;
}
- byte type = input.get();
+ byte type = input.GetByte();
// we have to check this isn't a protocol initiation frame here - we can't tell later on and we end up
// waiting for more data. This could be improved if MINA supported some kind of state awareness when decoding
@@ -65,13 +65,13 @@
return MessageDecoderResult.NOT_OK;
}
// zero, channel, body size and end byte
- if (input.remaining() < (1 + 2 + 4 + 1))
+ if (input.Remaining < (1 + 2 + 4 + 1))
{
return MessageDecoderResult.NEED_DATA;
}
-
- int channel = input.GetUnsignedShort();
- long bodySize = input.GetUnsignedInt();
+
+ int channel = input.GetUInt16();
+ long bodySize = input.GetUInt32();
// bodySize can be zero
if (type <= 0 || channel < 0 || bodySize < 0)
@@ -80,7 +80,7 @@
return MessageDecoderResult.NOT_OK;
}
- if (input.remaining() < (bodySize + 1))
+ if (input.Remaining < (bodySize + 1))
{
return MessageDecoderResult.NEED_DATA;
}
@@ -116,9 +116,9 @@
protected Object CreateAndPopulateFrame(ByteBuffer input)
{
- byte type = input.get();
- ushort channel = input.GetUnsignedShort();
- uint bodySize = input.GetUnsignedInt();
+ byte type = input.GetByte();
+ ushort channel = input.GetUInt16();
+ uint bodySize = input.GetUInt32();
IBodyFactory bodyFactory = (IBodyFactory)_supportedBodies[type];
if (bodyFactory == null)
@@ -129,7 +129,7 @@
frame.PopulateFromBuffer(input, channel, bodySize, bodyFactory);
- byte marker = input.get();
+ byte marker = input.GetByte();
if (marker != 0xCE) {
throw new FormatException("marker is not 0xCE");
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockEncoder.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockEncoder.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockEncoder.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQDataBlockEncoder.cs Mon Feb 26 09:46:07 2007
@@ -51,14 +51,14 @@
{
IDataBlock frame = (IDataBlock) message;
int frameSize = (int)frame.Size; // TODO: sort out signed/unsigned
- ByteBuffer buffer = ByteBuffer.allocate(frameSize);
+ ByteBuffer buffer = ByteBuffer.Allocate(frameSize);
frame.WritePayload(buffer);
if (_logger.IsDebugEnabled)
{
_logger.Debug("Encoded frame byte-buffer is '" + ByteBufferHexDumper.GetHexDump(buffer) + "'");
}
- buffer.flip();
+ buffer.Flip();
output.Write(buffer);
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQFrame.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQFrame.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQFrame.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQFrame.cs Mon Feb 26 09:46:07 2007
@@ -74,12 +74,12 @@
public void WritePayload(ByteBuffer buffer)
{
- buffer.put(_bodyFrame.BodyType);
+ buffer.Put(_bodyFrame.BodyType);
// TODO: how does channel get populated
- buffer.put(_channel);
- buffer.put(_bodyFrame.Size);
+ buffer.Put(_channel);
+ buffer.Put(_bodyFrame.Size);
_bodyFrame.WritePayload(buffer);
- buffer.put((byte) 0xCE);
+ buffer.Put((byte) 0xCE);
}
#endregion
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBody.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBody.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBody.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBody.cs Mon Feb 26 09:46:07 2007
@@ -62,8 +62,8 @@
public void WritePayload(ByteBuffer buffer)
{
- buffer.put(Clazz);
- buffer.put(Method);
+ buffer.Put(Clazz);
+ buffer.Put(Method);
WriteMethodPayload(buffer);
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBodyFactory.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBodyFactory.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBodyFactory.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQMethodBodyFactory.cs Mon Feb 26 09:46:07 2007
@@ -39,7 +39,7 @@
/// <exception>AMQFrameDecodingException</exception>
public IBody CreateBody(ByteBuffer inbuf)
{
- return MethodBodyDecoderRegistry.Get(inbuf.GetUnsignedShort(), inbuf.GetUnsignedShort());
+ return MethodBodyDecoderRegistry.Get(inbuf.GetUInt16(), inbuf.GetUInt16());
}
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQType.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQType.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQType.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQType.cs Mon Feb 26 09:46:07 2007
@@ -63,7 +63,7 @@
/// <param name="buffer">Buffer to write to</param>
public void WriteToBuffer(object value, ByteBuffer buffer)
{
- buffer.put(Identifier);
+ buffer.Put(Identifier);
WriteValueImpl(value, buffer);
}
@@ -163,7 +163,7 @@
sealed class AMQUInt32Type : AMQType
{
- public AMQUInt32Type() : base('I')
+ public AMQUInt32Type() : base('i')
{
}
@@ -560,7 +560,7 @@
sealed class AMQInt32Type : AMQType
{
- public AMQInt32Type() : base('i')
+ public AMQInt32Type() : base('I')
{
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQTypedValue.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQTypedValue.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQTypedValue.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/AMQTypedValue.cs Mon Feb 26 09:46:07 2007
@@ -64,7 +64,7 @@
public static AMQTypedValue ReadFromBuffer(ByteBuffer buffer)
{
- AMQType type = AMQTypeMap.GetType(buffer.get());
+ AMQType type = AMQTypeMap.GetType(buffer.GetByte());
return new AMQTypedValue(type, buffer);
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/BasicContentHeaderProperties.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/BasicContentHeaderProperties.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/BasicContentHeaderProperties.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/BasicContentHeaderProperties.cs Mon Feb 26 09:46:07 2007
@@ -41,7 +41,7 @@
public string CorrelationId;
- public uint Expiration;
+ public long Expiration;
public string ReplyTo;
@@ -102,13 +102,13 @@
EncodingUtils.WriteShortStringBytes(buffer, ContentType);
EncodingUtils.WriteShortStringBytes(buffer, Encoding);
EncodingUtils.WriteFieldTableBytes(buffer, Headers);
- buffer.put(DeliveryMode);
- buffer.put(Priority);
+ buffer.Put(DeliveryMode);
+ buffer.Put(Priority);
EncodingUtils.WriteShortStringBytes(buffer, CorrelationId);
EncodingUtils.WriteShortStringBytes(buffer, ReplyTo);
EncodingUtils.WriteShortStringBytes(buffer, String.Format("{0:D}", Expiration));
EncodingUtils.WriteShortStringBytes(buffer, MessageId);
- buffer.put(Timestamp);
+ buffer.Put(Timestamp);
EncodingUtils.WriteShortStringBytes(buffer, Type);
EncodingUtils.WriteShortStringBytes(buffer, UserId);
EncodingUtils.WriteShortStringBytes(buffer, AppId);
@@ -125,19 +125,19 @@
if ((propertyFlags & (1 << 13)) > 0)
Headers = EncodingUtils.ReadFieldTable(buffer);
if ((propertyFlags & (1 << 12)) > 0)
- DeliveryMode = buffer.get();
+ DeliveryMode = buffer.GetByte();
if ((propertyFlags & (1 << 11)) > 0)
- Priority = buffer.get();
+ Priority = buffer.GetByte();
if ((propertyFlags & (1 << 10)) > 0)
CorrelationId = EncodingUtils.ReadShortString(buffer);
if ((propertyFlags & (1 << 9)) > 0)
ReplyTo = EncodingUtils.ReadShortString(buffer);
if ((propertyFlags & (1 << 8)) > 0)
- Expiration = UInt32.Parse(EncodingUtils.ReadShortString(buffer));
+ Expiration = EncodingUtils.ReadLongAsShortString(buffer);
if ((propertyFlags & (1 << 7)) > 0)
MessageId = EncodingUtils.ReadShortString(buffer);
- if ((propertyFlags & (1 << 6)) > 0)
- Timestamp = buffer.GetUnsignedLong();
+ if ((propertyFlags & (1 << 6)) > 0)
+ Timestamp = buffer.GetUInt64();
if ((propertyFlags & (1 << 5)) > 0)
Type = EncodingUtils.ReadShortString(buffer);
if ((propertyFlags & (1 << 4)) > 0)
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentBody.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentBody.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentBody.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentBody.cs Mon Feb 26 09:46:07 2007
@@ -54,7 +54,7 @@
{
if (Payload != null)
{
- buffer.put(Payload);
+ buffer.Put(Payload);
}
}
@@ -63,7 +63,7 @@
if (size > 0)
{
Payload = new byte[size];
- buffer.get(Payload);
+ buffer.GetBytes(Payload);
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentHeaderBody.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentHeaderBody.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentHeaderBody.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ContentHeaderBody.cs Mon Feb 26 09:46:07 2007
@@ -73,19 +73,19 @@
public void WritePayload(ByteBuffer buffer)
{
- buffer.put(ClassId);
- buffer.put(Weight);
- buffer.put(BodySize);
- buffer.put(Properties.PropertyFlags);
+ buffer.Put(ClassId);
+ buffer.Put(Weight);
+ buffer.Put(BodySize);
+ buffer.Put(Properties.PropertyFlags);
Properties.WritePropertyListPayload(buffer);
}
public void PopulateFromBuffer(ByteBuffer buffer, uint size)
{
- ClassId = buffer.GetUnsignedShort();
- Weight = buffer.GetUnsignedShort();
- BodySize = buffer.GetUnsignedLong();
- ushort propertyFlags = buffer.GetUnsignedShort();
+ ClassId = buffer.GetUInt16();
+ Weight = buffer.GetUInt16();
+ BodySize = buffer.GetUInt64();
+ ushort propertyFlags = buffer.GetUInt16();
ContentHeaderPropertiesFactory factory = ContentHeaderPropertiesFactory.GetInstance();
Properties = factory.CreateContentHeaderProperties(ClassId, propertyFlags, buffer);
}