MyStream.Read C# (CSharp) Method

Read() public method

public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int
 public override int Read(byte[] buffer, int offset, int count)  { return 0;}
 public override int ReadByte()  {return 0; }

Usage Example

コード例 #1
0
ファイル: Utils.cs プロジェクト: gswsCodetree/gswsjuncode
        public static bool IsPdf(HttpPostedFileBase DocumentUpload)
        {
            var pdfString = "%PDF-";
            var pdfBytes  = Encoding.ASCII.GetBytes(pdfString);
            var len       = pdfBytes.Length;

            int FileLen;

            System.IO.Stream MyStream;

            FileLen = DocumentUpload.ContentLength;
            byte[] buffer = new byte[len];

            // Initialize the stream.
            MyStream = DocumentUpload.InputStream;

            // Read the file into the byte array.
            if (FileLen >= len)
            {
                MyStream.Read(buffer, 0, len);
            }
            else
            {
                MyStream.Read(buffer, 0, FileLen);
            }



            return(pdfBytes.SequenceEqual(buffer));
        }
All Usage Examples Of MyStream::Read