System.IO.FileStreamEx.ReadData C# (CSharp) Méthode

ReadData() public méthode

Read data from specific FileStream and return it as MemoryStream
public ReadData ( int Length ) : MemoryStream
Length int Length that must read
Résultat MemoryStream
        public MemoryStream ReadData(int Length)
        {
            MemoryStream ms;
            byte[] Buf = new byte[Length];
            base.Read(Buf, 0, Length);
            ms = new MemoryStream();
            ms.Write(Buf, 0, Length);

            return ms;
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Create new AttachedPictureFrame
        /// </summary>
        /// <param name="FrameID">4 Characters tag identifier</param>
        /// <param name="Flags">2 Bytes flags identifier</param>
        /// <param name="Data">Contain Data for this frame</param>
        /// <param name="Length">MaxLength of frame</param>
        internal AttachedPictureFrame(string FrameID, FrameFlags Flags, FileStreamEx Data, int Length)
            : base(FrameID, Flags)
        {
            _TextEncoding = (TextEncodings)Data.ReadByte();
            Length--;
            if (!IsValidEnumValue(_TextEncoding, ValidatingErrorTypes.ID3Error))
            {
                _MustDrop = true;
                return;
            }

            _MIMEType = Data.ReadText(Length, TextEncodings.Ascii, ref Length, true);

            _PictureType = (PictureTypes)Data.ReadByte();
            Length--;

            _Description = Data.ReadText(Length, _TextEncoding, ref Length, true);

            _Data = Data.ReadData(Length);
        }
All Usage Examples Of System.IO.FileStreamEx::ReadData