summaryrefslogtreecommitdiff
path: root/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
commitb10ee442673d6d9c8abb46bd7a0606364930130d (patch)
tree07827981760e15f8dcf5f5af892c3a0bad2eba66 /dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
parent7d0a7581134379324b36d78f8c49dcd793d1ab1e (diff)
downloadqpid-python-b10ee442673d6d9c8abb46bd7a0606364930130d.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/qpid@486248 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs')
-rw-r--r--dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs b/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
index a9b7d629db..650186a90b 100644
--- a/dotnet/Qpid.Client/Client/Message/QpidTextMessage.cs
+++ b/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;
}
}