summaryrefslogtreecommitdiff
path: root/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
diff options
context:
space:
mode:
authorSteven Shaw <steshaw@apache.org>2006-12-12 17:36:17 +0000
committerSteven Shaw <steshaw@apache.org>2006-12-12 17:36:17 +0000
commitad8fa512e788075a4573678738b6f11f1c8cbd59 (patch)
tree69eef3dfec5848f489a9f129237e38ae35b3079c /qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
parent4e1735463fdb63f87d03541c33a816a5c7af563f (diff)
downloadqpid-python-ad8fa512e788075a4573678738b6f11f1c8cbd59.tar.gz
QPID-139. Initial (re)port of MINA's bytebuffer abstraction. Now includes the autoexpand feature. References to java.nio.Buffer were replaced with FixedByteBuffer and necessary methods added and implemented. FixedByteBuffer delegates to our existing HeapByteBuffer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@486248 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs')
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs b/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
index a9b7d629db..650186a90b 100644
--- a/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
+++ b/qpid/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
@@ -90,7 +90,7 @@ namespace Qpid.Client.Message
{
if (_data != null)
{
- _data.Release();
+ _data.release();
}
_data = null;
_decodedValue = null;
@@ -122,15 +122,20 @@ namespace Qpid.Client.Message
return _decodedValue;
}
else
- {
+ {
+ // Read remaining bytes.
+ byte[] bytes = new byte[_data.remaining()];
+ _data.get(bytes);
+
+ // Convert to string based on encoding.
if (ContentHeaderProperties.Encoding != null)
{
// throw ArgumentException if the encoding is not supported
- _decodedValue = Encoding.GetEncoding(ContentHeaderProperties.Encoding).GetString(_data.ToByteArray());
+ _decodedValue = Encoding.GetEncoding(ContentHeaderProperties.Encoding).GetString(bytes);
}
else
{
- _decodedValue = Encoding.Default.GetString(_data.ToByteArray());
+ _decodedValue = Encoding.Default.GetString(bytes);
}
return _decodedValue;
}
@@ -148,7 +153,7 @@ namespace Qpid.Client.Message
// throw ArgumentException if the encoding is not supported
bytes = Encoding.GetEncoding(ContentHeaderProperties.Encoding).GetBytes(value);
}
- _data = HeapByteBuffer.wrap(bytes, bytes.Length);
+ _data = ByteBuffer.wrap(bytes);
_decodedValue = value;
}
}