System.IO.UnmanagedMemoryStream.UnmanagedMemoryStream.Read C# (CSharp) Méthode

Read() public méthode

public Read ( [ buffer, int offset, int count ) : int
buffer [
offset int
count int
Résultat int
		public override int Read ([InAttribute] [OutAttribute] byte[] buffer, int offset, int count)
		{
			if (closed)
				throw new ObjectDisposedException("The stream is closed");
			
			if (buffer == null)
				throw new ArgumentNullException("buffer");
			if (offset < 0)
				throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
			if (count < 0)
				throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
			if ((buffer.Length - offset) < count)
				throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
			
			if (fileaccess == FileAccess.Write)
				throw new NotSupportedException("Stream does not support reading");
			else {
				if (current_position >= length)
					return (0);
				else {
					int progress = current_position + count < length ? count : (int) (length - current_position);
					Marshal.Copy (new IntPtr (initial_pointer.ToInt64 () + current_position), buffer, offset, progress);
					current_position += progress;
					return progress;
				}
			}
		}