forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathByteSerializer.cs
More file actions
30 lines (25 loc) · 910 Bytes
/
Copy pathByteSerializer.cs
File metadata and controls
30 lines (25 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// -----------------------------------------------------------------------
// <copyright file="ByteSerializer.cs" company="Asynkron HB">
// Copyright (C) 2015-2017 Asynkron HB All rights reserved
// </copyright>
// -----------------------------------------------------------------------
using System.IO;
namespace Wire.ValueSerializers
{
public class ByteSerializer : SessionIgnorantValueSerializer<byte>
{
public const byte Manifest = 4;
public static readonly ByteSerializer Instance = new ByteSerializer();
public ByteSerializer() : base(Manifest, () => WriteValueImpl, () => ReadValueImpl)
{
}
public static void WriteValueImpl(Stream stream, byte b)
{
stream.WriteByte(b);
}
public static byte ReadValueImpl(Stream stream)
{
return (byte) stream.ReadByte();
}
}
}