C# 클래스 Redzen.IO.StreamHelper

General purpose helper methods for working with streams.
파일 보기 프로젝트 열기: colgreen/Redzen

공개 메소드들

메소드 설명
Copy ( Stream inputStream, Stream outputStream ) : void

Copy all bytes from an input stream into an output stream until the end of the input stream is reached.

Note. .NET 4 introduced CopyTo() methods to the stream base class that makes this method unnecessary.

Copy ( Stream inputStream, Stream outputStream, byte buffer ) : void

Copy all bytes from an input stream into an output stream until the end of the input stream is reached.

Note. .NET 4 introduced CopyTo() methods to the stream base class that makes this method unnecessary.

Read ( Stream stream, byte data ) : int

Reads data from a stream into a provided array. Reads up to the length of array and returns the number of bytes read.

Unlike Stream.Read(), this method guarantees to read bytes until the end of stream is reached.

ReadFill ( Stream stream, byte data ) : void

Reads data from a stream into a provided array, filling the array. If the end of the stream is reached before the array is filled then an EndOfStreamException is thrown.

Unlike Stream.Read(), this method guarantees to fill the byte array if the stream has sufficient bytes.

ReadToByteArray ( Stream stream ) : byte[]

Read stream into byte array. Reads until the end of stream is reached and returns entire stream contents as a new byte array.

메소드 상세

Copy() 공개 정적인 메소드

Copy all bytes from an input stream into an output stream until the end of the input stream is reached.
Note. .NET 4 introduced CopyTo() methods to the stream base class that makes this method unnecessary.
public static Copy ( Stream inputStream, Stream outputStream ) : void
inputStream System.IO.Stream The input stream to read bytes from.
outputStream System.IO.Stream The output stream to write bytes into.
리턴 void

Copy() 공개 정적인 메소드

Copy all bytes from an input stream into an output stream until the end of the input stream is reached.
Note. .NET 4 introduced CopyTo() methods to the stream base class that makes this method unnecessary.
public static Copy ( Stream inputStream, Stream outputStream, byte buffer ) : void
inputStream System.IO.Stream The input stream to read bytes from.
outputStream System.IO.Stream The output stream to write bytes into.
buffer byte A pre-allocated byte buffer.
리턴 void

Read() 공개 정적인 메소드

Reads data from a stream into a provided array. Reads up to the length of array and returns the number of bytes read.
Unlike Stream.Read(), this method guarantees to read bytes until the end of stream is reached.
public static Read ( Stream stream, byte data ) : int
stream System.IO.Stream The stream to read data from.
data byte The array to read bytes into.
리턴 int

ReadFill() 공개 정적인 메소드

Reads data from a stream into a provided array, filling the array. If the end of the stream is reached before the array is filled then an EndOfStreamException is thrown.
Unlike Stream.Read(), this method guarantees to fill the byte array if the stream has sufficient bytes.
public static ReadFill ( Stream stream, byte data ) : void
stream System.IO.Stream The stream to read data from.
data byte The array to read bytes into.
리턴 void

ReadToByteArray() 공개 정적인 메소드

Read stream into byte array. Reads until the end of stream is reached and returns entire stream contents as a new byte array.
public static ReadToByteArray ( Stream stream ) : byte[]
stream System.IO.Stream The stream to read data from.
리턴 byte[]