C# Class ToolBelt.StreamUtility

ファイルを表示 Open project: jlyonsmith/ToolBelt

Public Methods

Method Description
Copy ( Stream input, Stream output ) : void

Copies all the data from one stream into another.

Copy ( Stream input, Stream output, IBuffer buffer ) : void

Copies all the data from one stream into another, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.

Copy ( Stream input, Stream output, byte buffer ) : void

Copies all the data from one stream into another, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.

Copy ( Stream input, Stream output, int bufferSize ) : void

Copies all the data from one stream into another, using a buffer of the given size.

ReadExactly ( Stream input, IBuffer buffer ) : byte[]

Reads into a buffer, filling it completely.

ReadExactly ( Stream input, IBuffer buffer, int bytesToRead ) : byte[]

Reads into a buffer, for the given number of bytes.

ReadExactly ( Stream input, IBuffer buffer, int startIndex, int bytesToRead ) : byte[]

Reads into a buffer, for the given number of bytes, from the specified location

ReadExactly ( Stream input, byte buffer ) : byte[]

Reads into a buffer, filling it completely.

ReadExactly ( Stream input, byte buffer, int bytesToRead ) : byte[]

Reads exactly the given number of bytes from the specified stream, into the given buffer, starting at position 0 of the array.

ReadExactly ( Stream input, byte buffer, int startIndex, int bytesToRead ) : byte[]

Reads exactly the given number of bytes from the specified stream, into the given buffer, starting at position 0 of the array.

ReadExactly ( Stream input, int bytesToRead ) : byte[]

Reads exactly the given number of bytes from the specified stream. If the end of the stream is reached before the specified amount of data is read, an exception is thrown.

ReadFully ( Stream input ) : byte[]

Reads the given stream up to the end, returning the data as a byte array.

ReadFully ( Stream input, IBuffer buffer ) : byte[]

Reads the given stream up to the end, returning the data as a byte array, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.

ReadFully ( Stream input, byte buffer ) : byte[]

Reads the given stream up to the end, returning the data as a byte array, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.

ReadFully ( Stream input, int bufferSize ) : byte[]

Reads the given stream up to the end, returning the data as a byte array, using the given buffer size.

Method Details

Copy() public static method

Copies all the data from one stream into another.
input is null output is null An error occurs while reading or writing
public static Copy ( Stream input, Stream output ) : void
input Stream The stream to read from
output Stream The stream to write to
return void

Copy() public static method

Copies all the data from one stream into another, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.
input is null output is null buffer is null An error occurs while reading or writing
public static Copy ( Stream input, Stream output, IBuffer buffer ) : void
input Stream The stream to read from
output Stream The stream to write to
buffer IBuffer The buffer to use to transfer data
return void

Copy() public static method

Copies all the data from one stream into another, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.
input is null output is null buffer is null buffer is a zero-length array An error occurs while reading or writing
public static Copy ( Stream input, Stream output, byte buffer ) : void
input Stream The stream to read from
output Stream The stream to write to
buffer byte The buffer to use to transfer data
return void

Copy() public static method

Copies all the data from one stream into another, using a buffer of the given size.
input is null output is null bufferSize is less than 1 An error occurs while reading or writing
public static Copy ( Stream input, Stream output, int bufferSize ) : void
input Stream The stream to read from
output Stream The stream to write to
bufferSize int The size of buffer to use when reading
return void

ReadExactly() public static method

Reads into a buffer, filling it completely.
input is null The buffer is of zero length The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, IBuffer buffer ) : byte[]
input Stream The stream to read from
buffer IBuffer The buffer to read into
return byte[]

ReadExactly() public static method

Reads into a buffer, for the given number of bytes.
input is null The buffer is of zero length, or bytesToRead /// exceeds the buffer length The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, IBuffer buffer, int bytesToRead ) : byte[]
input Stream The stream to read from
buffer IBuffer The buffer to read into
bytesToRead int The number of bytes to read
return byte[]

ReadExactly() public static method

Reads into a buffer, for the given number of bytes, from the specified location
input is null The buffer is of zero length, or startIndex+bytesToRead /// exceeds the buffer length The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, IBuffer buffer, int startIndex, int bytesToRead ) : byte[]
input Stream The stream to read from
buffer IBuffer The buffer to read into
startIndex int The index into the buffer at which to start writing
bytesToRead int The number of bytes to read
return byte[]

ReadExactly() public static method

Reads into a buffer, filling it completely.
input is null The buffer is of zero length The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, byte buffer ) : byte[]
input Stream The stream to read from
buffer byte The buffer to read into
return byte[]

ReadExactly() public static method

Reads exactly the given number of bytes from the specified stream, into the given buffer, starting at position 0 of the array.
input is null bytesToRead is less than 1 The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, byte buffer, int bytesToRead ) : byte[]
input Stream The stream to read from
buffer byte The byte array to read into
bytesToRead int The number of bytes to read
return byte[]

ReadExactly() public static method

Reads exactly the given number of bytes from the specified stream, into the given buffer, starting at position 0 of the array.
input is null bytesToRead is less than 1, startIndex is less than 0, /// or startIndex+bytesToRead is greater than the buffer length The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, byte buffer, int startIndex, int bytesToRead ) : byte[]
input Stream The stream to read from
buffer byte The byte array to read into
startIndex int The index into the buffer at which to start writing
bytesToRead int The number of bytes to read
return byte[]

ReadExactly() public static method

Reads exactly the given number of bytes from the specified stream. If the end of the stream is reached before the specified amount of data is read, an exception is thrown.
input is null bytesToRead is less than 1 The end of the stream is reached before /// enough data has been read An error occurs while reading from the stream
public static ReadExactly ( Stream input, int bytesToRead ) : byte[]
input Stream The stream to read from
bytesToRead int The number of bytes to read
return byte[]

ReadFully() public static method

Reads the given stream up to the end, returning the data as a byte array.
input is null An error occurs while reading from the stream
public static ReadFully ( Stream input ) : byte[]
input Stream The stream to read from
return byte[]

ReadFully() public static method

Reads the given stream up to the end, returning the data as a byte array, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.
input is null buffer is null An error occurs while reading from the stream
public static ReadFully ( Stream input, IBuffer buffer ) : byte[]
input Stream The stream to read from
buffer IBuffer The buffer to use to transfer data
return byte[]

ReadFully() public static method

Reads the given stream up to the end, returning the data as a byte array, using the given buffer for transferring data. Note that the current contents of the buffer is ignored, so the buffer needn't be cleared beforehand.
input is null buffer is null buffer is a zero-length array An error occurs while reading from the stream
public static ReadFully ( Stream input, byte buffer ) : byte[]
input Stream The stream to read from
buffer byte The buffer to use to transfer data
return byte[]

ReadFully() public static method

Reads the given stream up to the end, returning the data as a byte array, using the given buffer size.
input is null bufferSize is less than 1 An error occurs while reading from the stream
public static ReadFully ( Stream input, int bufferSize ) : byte[]
input Stream The stream to read from
bufferSize int The size of buffer to use when reading
return byte[]