/// <summary> /// Reads a data blob from the specified stream. /// </summary> /// <param name="stream">Input stream</param> /// <returns>Data blob</returns> public static ExportDataBlob FromStream(Stream stream) { if (stream == null || !stream.CanRead) { return(null); } BlobBinaryReader reader = new BlobBinaryReader(stream); try { return(ReadBlob(reader)); } finally { reader.Close(); //Make sure we close and not Dispose, to prevent underlying stream from being disposed. } }
/// <summary> /// Reads a data blob from the specified stream. /// </summary> /// <param name="stream">Input stream</param> /// <returns>Data blob</returns> public static ExportDataBlob FromStream(Stream stream) { if(stream == null || !stream.CanRead) return null; BlobBinaryReader reader = new BlobBinaryReader(stream); try { return ReadBlob(reader); } finally { reader.Close(); //Make sure we close and not Dispose, to prevent underlying stream from being disposed. } }