C# Class fCraft.BufferUtil

Provides utility methods for working with byte arrays and pointers.
Afficher le fichier Open project: fragmer/fCraft Class Usage Examples

Méthodes publiques

Méthode Description
MemCpy ( [ src, [ dest, int len ) : void

Copies contents of src buffer to dest buffer, as efficiently as possible.

MemSet ( [ array, byte value ) : void

Fills the entire given byte array with a specified byte value, as efficiently as possible.

MemSet ( [ array, byte value, int startIndex, int length ) : void

Fills a section of the given byte array with a specified byte value, as efficiently as possible.

ReadAll ( [ source, [ destination ) : void

Reads a number of bytes from source that matches the length of destination byte array.

WriteAll ( [ source, [ destination ) : void

Writes contents of given byte array to a stream, in chunks of at most 512 MiB. Works around an overflow in BufferedStream.Write(byte[]) that happens on 1 GiB+ writes.

Private Methods

Méthode Description
MemCmp ( [ data, int offset, [ value ) : bool

Method Details

MemCpy() public static méthode

Copies contents of src buffer to dest buffer, as efficiently as possible.
public static MemCpy ( [ src, [ dest, int len ) : void
src [ Source array/pointer.
dest [ Destination array/pointer.
len int Number of bytes to copy.
Résultat void

MemSet() public static méthode

Fills the entire given byte array with a specified byte value, as efficiently as possible.
array is null.
public static MemSet ( [ array, byte value ) : void
array [ Array to work with.
value byte Value to assign to each byte of the array.
Résultat void

MemSet() public static méthode

Fills a section of the given byte array with a specified byte value, as efficiently as possible.
array is null. length is negative; startIndex is negative; /// or if (length+startIndex) is greater than array length.
public static MemSet ( [ array, byte value, int startIndex, int length ) : void
array [ Array to work with.
value byte Value to assign to each byte of the array.
startIndex int Index of the first byte that should be set.
length int Number of bytes of the array to set.
Résultat void

ReadAll() public static méthode

Reads a number of bytes from source that matches the length of destination byte array.
source or destination is null. The end of stream is reached before destination array was filled.
public static ReadAll ( [ source, [ destination ) : void
source [ Stream to read from.
destination [ Byte array to write to. Length of this array is used.
Résultat void

WriteAll() public static méthode

Writes contents of given byte array to a stream, in chunks of at most 512 MiB. Works around an overflow in BufferedStream.Write(byte[]) that happens on 1 GiB+ writes.
source or destination is null.
public static WriteAll ( [ source, [ destination ) : void
source [ Byte array to read from. Must not be null.
destination [ Stream to write to. Must not be null.
Résultat void