mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 10:19:51 +00:00
csharp: add BoxingPacker tests
This commit is contained in:
parent
8e923777b8
commit
05ac2603e6
3 changed files with 109 additions and 1 deletions
|
|
@ -21,6 +21,14 @@ namespace msgpack
|
|||
Pack (writer, o);
|
||||
}
|
||||
|
||||
public byte[] Pack (object o)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream ()) {
|
||||
Pack (ms, o);
|
||||
return ms.ToArray ();
|
||||
}
|
||||
}
|
||||
|
||||
void Pack (MsgPackWriter writer, object o)
|
||||
{
|
||||
if (o == null) {
|
||||
|
|
@ -86,6 +94,18 @@ namespace msgpack
|
|||
return Unpack (reader);
|
||||
}
|
||||
|
||||
public object Unpack (byte[] buf, int offset, int size)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream (buf, offset, size)) {
|
||||
return Unpack (ms);
|
||||
}
|
||||
}
|
||||
|
||||
public object Unpack (byte[] buf)
|
||||
{
|
||||
return Unpack (buf, 0, buf.Length);
|
||||
}
|
||||
|
||||
object Unpack (MsgPackReader reader)
|
||||
{
|
||||
if (!reader.Read ())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue