Xeno-rat
Loading...
Searching...
No Matches
NAudio.Utils.ByteEncoding Class Reference

An encoding for use with file types that have one byte per character. More...

Inheritance diagram for NAudio.Utils.ByteEncoding:
Collaboration diagram for NAudio.Utils.ByteEncoding:

Public Member Functions

override int GetByteCount (char[] chars, int index, int count)
 Gets the number of bytes required to encode a set of characters from the specified character array.
 
override int GetBytes (char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
 Encodes a set of characters from the specified character array into the specified byte array.
 
override int GetCharCount (byte[] bytes, int index, int count)
 Returns the number of characters produced by decoding a sequence of bytes from the specified byte array.
 
override int GetChars (byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
 Decodes a sequence of bytes from the specified byte array into the specified character array.
 
override int GetMaxCharCount (int byteCount)
 Returns the maximum number of characters produced by decoding the specified number of bytes.
 
override int GetMaxByteCount (int charCount)
 Returns the maximum number of bytes required to encode the specified number of characters.
 

Static Public Attributes

static readonly ByteEncoding Instance = new ByteEncoding()
 The one and only instance of this class.
 

Private Member Functions

 ByteEncoding ()
 

Detailed Description

An encoding for use with file types that have one byte per character.

Constructor & Destructor Documentation

◆ ByteEncoding()

NAudio.Utils.ByteEncoding.ByteEncoding ( )
inlineprivate

Member Function Documentation

◆ GetByteCount()

override int NAudio.Utils.ByteEncoding.GetByteCount ( char[] chars,
int index,
int count )
inline

Gets the number of bytes required to encode a set of characters from the specified character array.

Parameters
charsThe character array containing the set of characters to encode.
indexThe index of the first character in the character array to encode.
countThe number of characters to encode.
Returns
The number of bytes required to encode the specified set of characters.

◆ GetBytes()

override int NAudio.Utils.ByteEncoding.GetBytes ( char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inline

Encodes a set of characters from the specified character array into the specified byte array.

Parameters
charsThe character array containing the characters to encode.
charIndexThe index of the first character to encode.
charCountThe number of characters to encode.
bytesThe byte array to contain the resulting sequence of bytes.
byteIndexThe index at which to start writing the resulting sequence of bytes.
Returns
The total number of bytes written into the byte array.

This method encodes a set of characters from the specified character array into the specified byte array. It iterates through the characters in the input character array and casts each character to a byte, then stores it in the output byte array. The method returns the total number of bytes written into the byte array, which is equal to the number of characters encoded.

◆ GetCharCount()

override int NAudio.Utils.ByteEncoding.GetCharCount ( byte[] bytes,
int index,
int count )
inline

Returns the number of characters produced by decoding a sequence of bytes from the specified byte array.

Parameters
bytesThe byte array containing the sequence of bytes to decode.
indexThe index of the first byte to decode.
countThe number of bytes to decode.
Returns
The number of characters produced by decoding the specified sequence of bytes.

This method iterates through the specified byte array starting from the given index and counts the number of characters until it encounters a null byte (0). If no null byte is encountered within the specified count, it returns the total count.

◆ GetChars()

override int NAudio.Utils.ByteEncoding.GetChars ( byte[] bytes,
int byteIndex,
int byteCount,
char[] chars,
int charIndex )
inline

Decodes a sequence of bytes from the specified byte array into the specified character array.

Parameters
bytesThe byte array containing the sequence of bytes to decode.
byteIndexThe index of the first byte to decode.
byteCountThe number of bytes to decode.
charsThe character array to contain the resulting decoded characters.
charIndexThe index at which to start writing the resulting decoded characters.
Returns
The actual number of characters written into chars .

This method decodes a sequence of bytes from the specified byte array into the specified character array using the default character encoding. It starts at the specified byte index and decodes the specified number of bytes. If a null byte is encountered during decoding, the method returns the number of characters decoded up to that point.

◆ GetMaxByteCount()

override int NAudio.Utils.ByteEncoding.GetMaxByteCount ( int charCount)
inline

Returns the maximum number of bytes required to encode the specified number of characters.

Parameters
charCountThe number of characters to encode.
Returns
The maximum number of bytes required to encode the specified number of characters.

◆ GetMaxCharCount()

override int NAudio.Utils.ByteEncoding.GetMaxCharCount ( int byteCount)
inline

Returns the maximum number of characters produced by decoding the specified number of bytes.

Parameters
byteCountThe number of bytes to decode.
Returns
The maximum number of characters produced by decoding the specified number of bytes.

Member Data Documentation

◆ Instance

readonly ByteEncoding NAudio.Utils.ByteEncoding.Instance = new ByteEncoding()
static

The one and only instance of this class.


The documentation for this class was generated from the following file: