C# Класс fCraft.BufferUtil

Provides utility methods for working with byte arrays and pointers.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
MemCmp ( [ data, int offset, [ value ) : bool

Описание методов

MemCpy() публичный статический Метод

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.
Результат void

MemSet() публичный статический Метод

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.
Результат void

MemSet() публичный статический Метод

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.
Результат void

ReadAll() публичный статический Метод

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.
Результат void

WriteAll() публичный статический Метод

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.
Результат void