/// <summary> /// Creates the new <see cref="Unpacker"/> from specified stream. /// </summary> /// <param name="stream">The stream to be unpacked.</param> /// <param name="streamOptions"><see cref="PackerUnpackerStreamOptions"/> which specifies stream handling options.</param> /// <param name="unpackerOptions"><see cref="UnpackerOptions"/> which specifies various options. Specify <c>null</c> to use default options.</param> /// <returns><see cref="Unpacker"/> instance. This value will not be <c>null</c>.</returns> /// <exception cref="ArgumentNullException"><paramref name="stream"/> is <c>null</c>.</exception> public static Unpacker Create(Stream stream, PackerUnpackerStreamOptions streamOptions, UnpackerOptions unpackerOptions) { if (unpackerOptions == null || unpackerOptions.ValidationLevel == UnpackerValidationLevel.Collection) { return(new CollectionValidatingStreamUnpacker(stream, streamOptions)); } else { return(new FastStreamUnpacker(stream, streamOptions)); } }
public MessagePackStreamUnpacker(Stream stream, PackerUnpackerStreamOptions streamOptions) { if (stream == null) { throw new ArgumentNullException("stream"); } var options = streamOptions ?? PackerUnpackerStreamOptions.None; this._source = options.WrapStream(stream); this._ownsStream = options.OwnsStream; this._useStreamPosition = stream.CanSeek; this._offset = this._useStreamPosition ? stream.Position : 0L; }
public MessagePackStreamPacker(Stream stream, PackerUnpackerStreamOptions streamOptions, PackerCompatibilityOptions compatibilityOptions) : base(compatibilityOptions) { if (stream == null) { throw new ArgumentNullException("stream"); } var options = streamOptions ?? PackerUnpackerStreamOptions.None; this._destination = options.WrapStream(stream); this._ownsStream = options.OwnsStream; this._scalarBuffer = new byte[sizeof(ulong) + 1]; }
public StreamPacker( Stream stream, PackerCompatibilityOptions compatibilityOptions, PackerUnpackerStreamOptions streamOptions ) : base( compatibilityOptions ) { if ( stream == null ) { throw new ArgumentNullException( "stream" ); } var options = streamOptions ?? PackerUnpackerStreamOptions.None; this._stream = options.WrapStream( stream ); this._ownsStream = options.OwnsStream; }
/// <summary> /// Create standard Safe <see cref="Packer"/> instancde wrapping specified <see cref="Stream"/> with specified <see cref="PackerCompatibilityOptions"/>. /// </summary> /// <param name="stream"><see cref="Stream"/> object.</param> /// <param name="compatibilityOptions">A <see cref="PackerCompatibilityOptions"/> which specifies compatibility options.</param> /// <param name="streamOptions"><see cref="PackerUnpackerStreamOptions"/> which specifies stream handling options.</param> /// <returns>Safe <see cref="Packer"/>. This will not be null.</returns> /// <exception cref="ArgumentNullException"><paramref name="stream"/> is null.</exception> /// <remarks> /// You can specify any derived <see cref="Stream"/> class like FileStream, <see cref="MemoryStream"/>, /// NetworkStream, UnmanagedMemoryStream, or so. /// </remarks> public static Packer Create(Stream stream, PackerCompatibilityOptions compatibilityOptions, PackerUnpackerStreamOptions streamOptions) { return(new StreamPacker(stream, compatibilityOptions, streamOptions)); }
/// <summary> /// Creates the new <see cref="Unpacker"/> from specified stream. /// </summary> /// <param name="stream">The stream to be unpacked.</param> /// <param name="streamOptions"><see cref="PackerUnpackerStreamOptions"/> which specifies stream handling options.</param> /// <returns><see cref="Unpacker"/> instance.</returns> public static Unpacker Create(Stream stream, PackerUnpackerStreamOptions streamOptions) { return(new ItemsUnpacker(stream, streamOptions)); }
public CollectionValidatingStreamUnpacker(Stream stream, PackerUnpackerStreamOptions streamOptions) : base(stream, streamOptions) { }
public FastStreamUnpacker(Stream stream, PackerUnpackerStreamOptions streamOptions) : base(stream, streamOptions) { }
/// <summary> /// Creates the new <see cref="Unpacker"/> from specified stream. /// </summary> /// <param name="stream">The stream to be unpacked.</param> /// <param name="streamOptions"><see cref="PackerUnpackerStreamOptions"/> which specifies stream handling options.</param> /// <returns><see cref="Unpacker"/> instance. This value will not be <c>null</c>.</returns> /// <exception cref="ArgumentNullException"><paramref name="stream"/> is <c>null</c>.</exception> public static Unpacker Create(Stream stream, PackerUnpackerStreamOptions streamOptions) { return(Create(stream, streamOptions, null)); }
public ItemsUnpacker( Stream stream, PackerUnpackerStreamOptions streamOptions ) { if ( stream == null ) { throw new ArgumentNullException( "stream" ); } var options = streamOptions ?? PackerUnpackerStreamOptions.None; this._source = options.WrapStream( stream ); this._ownsStream = options.OwnsStream; this._useStreamPosition = stream.CanSeek; this._offset = this._useStreamPosition ? stream.Position : 0L; }
public StreamPacker(Stream stream, PackerCompatibilityOptions compatibilityOptions, PackerUnpackerStreamOptions streamOptions) : base(compatibilityOptions) { if (stream == null) { throw new ArgumentNullException("stream"); } var options = streamOptions ?? PackerUnpackerStreamOptions.None; this._stream = options.WrapStream(stream); this._ownsStream = options.OwnsStream; }
/// <summary> /// Create standard Safe <see cref="Packer"/> instancde wrapping specified <see cref="Stream"/> with specified <see cref="PackerCompatibilityOptions"/>. /// </summary> /// <param name="stream"><see cref="Stream"/> object.</param> /// <param name="compatibilityOptions">A <see cref="PackerCompatibilityOptions"/> which specifies compatibility options.</param> /// <param name="streamOptions"><see cref="PackerUnpackerStreamOptions"/> which specifies stream handling options.</param> /// <returns>Safe <see cref="Packer"/>. This will not be null.</returns> /// <exception cref="ArgumentNullException"><paramref name="stream"/> is null.</exception> /// <remarks> /// You can specify any derived <see cref="Stream"/> class like FileStream, <see cref="MemoryStream"/>, /// NetworkStream, UnmanagedMemoryStream, or so. /// </remarks> public static Packer Create( Stream stream, PackerCompatibilityOptions compatibilityOptions, PackerUnpackerStreamOptions streamOptions ) { return new StreamPacker( stream, compatibilityOptions, streamOptions ); }