public Stream ReadLengthPrefixedStream(int bufferSize) { if (bufferSize < 1) { throw new ArgumentOutOfRangeException("bufferSize", string.Format("The provided value '{0}' is not a positive integer.", bufferSize)); } var length = ProtocolBuffersEncoding.ReadUInt64(_stream); if (length > int.MaxValue) { throw new InvalidOperationException("Cannot read length prefixed stream with size more than int.MaxValue."); } //throw new ArgumentOutOfRangeException(string.Empty, "Cannot read length prefixed stream with size more than int.MaxValue."); // TODO implement using http://www.codeproject.com/Articles/13061/StreamMuxer var ms = new MemoryStream((int)length); _stream.CopyTo(ms, bufferSize); return(ms); }
public ulong?ReadNullableUInt64() { return(ProtocolBuffersEncoding.ReadNullableUInt64(_stream)); }
public uint ReadUInt32() { return(ProtocolBuffersEncoding.ReadUInt32(_stream)); }
public ushort ReadUInt16() { return(ProtocolBuffersEncoding.ReadUInt16(_stream)); }
public sbyte ReadSByte() { return(ProtocolBuffersEncoding.ReadSByte(_stream)); }
public void Write(byte[] value) { ProtocolBuffersEncoding.Write(_stream, value); }
public void Write(DateTime?value) { ProtocolBuffersEncoding.Write(_stream, value); }
public bool ReadBoolean() { return(ProtocolBuffersEncoding.ReadBoolean(_stream)); }
public char ReadChar() { return(ProtocolBuffersEncoding.ReadChar(_stream)); }
public decimal?ReadNullableDecimal() { return(ProtocolBuffersEncoding.ReadNullableDecimal(_stream)); }
public decimal ReadDecimal() { return(ProtocolBuffersEncoding.ReadDecimal(_stream)); }
public double?ReadNullableDouble() { return(ProtocolBuffersEncoding.ReadNullableDouble(_stream)); }
public double ReadDouble() { return(ProtocolBuffersEncoding.ReadDouble(_stream)); }
public float?ReadNullableFloat() { return(ProtocolBuffersEncoding.ReadNullableFloat(_stream)); }
public float ReadFloat() { return(ProtocolBuffersEncoding.ReadFloat(_stream)); }
public char?ReadNullableChar() { return(ProtocolBuffersEncoding.ReadNullableChar(_stream)); }
public void Write(ushort value) { ProtocolBuffersEncoding.Write(_stream, value); }
public string ReadString() { return(ProtocolBuffersEncoding.ReadString(_stream)); }
public void Write(decimal?value) { ProtocolBuffersEncoding.Write(_stream, value); }
public DateTime ReadDateTime() { return(ProtocolBuffersEncoding.ReadDateTime(_stream)); }
public void Write(Guid?value) { ProtocolBuffersEncoding.Write(_stream, value); }
public DateTime?ReadNullableDateTime() { return(ProtocolBuffersEncoding.ReadNullableDateTime(_stream)); }
public bool?ReadNullableBoolean() { return(ProtocolBuffersEncoding.ReadNullableBoolean(_stream)); }
public Guid ReadGuid() { return(ProtocolBuffersEncoding.ReadGuid(_stream)); }
public sbyte?ReadNullableSByte() { return(ProtocolBuffersEncoding.ReadNullableSByte(_stream)); }
public Guid?ReadNullableGuid() { return(ProtocolBuffersEncoding.ReadNullableGuid(_stream)); }
public ushort?ReadNullableUInt16() { return(ProtocolBuffersEncoding.ReadNullableUInt16(_stream)); }
public byte[] ReadByteArray() { return(ProtocolBuffersEncoding.ReadByteArray(_stream)); }
public uint?ReadNullableUInt32() { return(ProtocolBuffersEncoding.ReadNullableUInt32(_stream)); }
public ulong ReadUInt64() { return(ProtocolBuffersEncoding.ReadUInt64(_stream)); }