Beispiel #1
0
        public MsgPackWriter(Stream stream, ISerializationContext context)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (!stream.CanWrite)
            {
                throw new UnreadableStream("stream");
            }

            this.context      = context;
            this.outputStream = stream;
            this.buffer       = new byte[16];
            this.bitConverter = EndianBitConverter.Little;
            this.bytesWritten = 0;
        }
        public MsgPackWriter(Stream stream, SerializationContext context)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (!stream.CanWrite)
            {
                throw JsonSerializationException.StreamIsNotReadable();
            }

            this.context      = context;
            this.outputStream = stream;
            this.buffer       = new byte[32];
            this.bitConverter = EndianBitConverter.Big;
            this.bytesWritten = 0;
        }