Type StreamExtensions
Namespace ImageResizer.ExtensionMethods
Provides extension methods for copying streams
Methods
Public static methods
Byte[] CopyOrReturnBuffer(Stream src, Int64& length, bool entireStream, int chunkSize)
Byte[] CopyToBytes(Stream s, bool entireStream)
Copies the current stream into a byte[] array of exact size.
Parameters
-
Stream
s -
bool
entireStream - True to copy entire stream if seeakable, false to only copy remaining data
Byte[] CopyToBytes(Stream src, bool entireStream, int chunkSize)
Copies the current stream into a byte[] array of exact size
Parameters
-
Stream
src -
bool
entireStream - True to copy entire stream if seeakable, false to only copy remaining data.
-
int
chunkSize - The buffer size to use (in bytes) if a buffer is required. Default: 4KiB
Byte[] CopyToBytes(Stream s)
Copies the remaining data in the current stream to a byte[] array of exact size.
MemoryStream CopyToMemoryStream(Stream s)
Copies the remaining data in the current stream to a new MemoryStream instance.
MemoryStream CopyToMemoryStream(Stream s, bool entireStream)
Copies the current stream into a new MemoryStream instance.
Parameters
-
Stream
s -
bool
entireStream - True to copy entire stream if seeakable, false to only copy remaining data
MemoryStream CopyToMemoryStream(Stream s, bool entireStream, int chunkSize)
Copies the current stream into a new MemoryStream instance.
Parameters
-
Stream
s -
bool
entireStream - True to copy entire stream if seeakable, false to only copy remaining data
-
int
chunkSize - The buffer size to use (in bytes) if a buffer is required. Default: 4KiB
void CopyToStream(Stream s, Stream other, bool entireStream)
Copies this stream into the given stream
Parameters
-
Stream
s -
Stream
other - The stream to write to
-
bool
entireStream - True to copy entire stream if seeakable, false to only copy remaining data
void CopyToStream(Stream s, Stream other)
Copies the remaining data from the this stream into the given stream.
Parameters
-
Stream
s -
Stream
other - The stream to write to
void CopyToStream(Stream src, Stream dest, bool entireStream, int chunkSize)
Copies this stream into the given stream
Parameters
-
Stream
src -
Stream
dest - The stream to write to
-
bool
entireStream - True to copy entire stream if seeakable, false to only copy remaining data
-
int
chunkSize - True to copy entire stream if seeakable, false to only copy remaining data