Class StreamUtils
Provides simple System.IO.Stream" utilities.
Inheritance
Inherited Members
Namespace: ICSharpCode.SharpZipLib.Core
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public static class StreamUtils
Methods
| Improve this Doc View SourceCopy(Stream, Stream, Byte[])
Copy the contents of one System.IO.Stream to another.
Declaration
public static void Copy(Stream source, Stream destination, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The stream to source data from. |
System.IO.Stream | destination | The stream to write data to. |
System.Byte[] | buffer | The buffer to use during copying. |
Copy(Stream, Stream, Byte[], ProgressHandler, TimeSpan, Object, String)
Copy the contents of one System.IO.Stream to another.
Declaration
public static void Copy(Stream source, Stream destination, byte[] buffer, ProgressHandler progressHandler, TimeSpan updateInterval, object sender, string name)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The stream to source data from. |
System.IO.Stream | destination | The stream to write data to. |
System.Byte[] | buffer | The buffer to use during copying. |
ProgressHandler | progressHandler | The progress handler delegate to use. |
System.TimeSpan | updateInterval | The minimum System.TimeSpan between progress updates. |
System.Object | sender | The source for this event. |
System.String | name | The name to use with the event. |
Remarks
This form is specialised for use within #Zip to support events during archive operations.
Copy(Stream, Stream, Byte[], ProgressHandler, TimeSpan, Object, String, Int64)
Copy the contents of one System.IO.Stream to another.
Declaration
public static void Copy(Stream source, Stream destination, byte[] buffer, ProgressHandler progressHandler, TimeSpan updateInterval, object sender, string name, long fixedTarget)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The stream to source data from. |
System.IO.Stream | destination | The stream to write data to. |
System.Byte[] | buffer | The buffer to use during copying. |
ProgressHandler | progressHandler | The progress handler delegate to use. |
System.TimeSpan | updateInterval | The minimum System.TimeSpan between progress updates. |
System.Object | sender | The source for this event. |
System.String | name | The name to use with the event. |
System.Int64 | fixedTarget | A predetermined fixed target value to use with progress updates. If the value is negative the target is calculated by looking at the stream. |
Remarks
This form is specialised for use within #Zip to support events during archive operations.
ReadFully(Stream, Byte[])
Read from a System.IO.Stream ensuring all the required data is read.
Declaration
public static void ReadFully(Stream stream, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to read. |
System.Byte[] | buffer | The buffer to fill. |
See Also
| Improve this Doc View SourceReadFully(Stream, Byte[], Int32, Int32)
Read from a System.IO.Stream" ensuring all the required data is read.
Declaration
public static void ReadFully(Stream stream, byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to read data from. |
System.Byte[] | buffer | The buffer to store data in. |
System.Int32 | offset | The offset at which to begin storing data. |
System.Int32 | count | The number of bytes of data to store. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Required parameter is null |
System.ArgumentOutOfRangeException |
|
System.IO.EndOfStreamException | End of stream is encountered before all the data has been read. |
ReadRequestedBytes(Stream, Byte[], Int32, Int32)
Read as much data as possible from a System.IO.Stream", up to the requested number of bytes
Declaration
public static int ReadRequestedBytes(Stream stream, byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to read data from. |
System.Byte[] | buffer | The buffer to store data in. |
System.Int32 | offset | The offset at which to begin storing data. |
System.Int32 | count | The number of bytes of data to store. |
Returns
Type | Description |
---|---|
System.Int32 |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Required parameter is null |
System.ArgumentOutOfRangeException |
|