Пример #1
0
        /// <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;

            //Reader set to leave the stream open
            using(BlobBinaryReader reader = new BlobBinaryReader(stream))
                return ReadBlob(reader);

        }
Пример #2
0
        /// <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.
            }
        }
Пример #3
0
        /// <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.
            }
        }