UTF32Encoding.GetBytes Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Codiert eine Reihe von Zeichen in eine Bytesequenz.
Überlädt
| Name | Beschreibung |
|---|---|
| GetBytes(Char*, Int32, Byte*, Int32) |
Codiert eine Reihe von Zeichen, die mit dem angegebenen Zeichenzeiger beginnen, in eine Abfolge von Bytes, die ab dem angegebenen Bytezeiger gespeichert werden. |
| GetBytes(Char[], Int32, Int32, Byte[], Int32) |
Codiert eine Reihe von Zeichen aus dem angegebenen Zeichenarray in das angegebene Bytearray. |
| GetBytes(String, Int32, Int32, Byte[], Int32) |
Codiert eine Reihe von Zeichen aus dem angegebenen String Bytearray. |
GetBytes(Char*, Int32, Byte*, Int32)
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
Wichtig
Diese API ist nicht CLS-kompatibel.
Codiert eine Reihe von Zeichen, die mit dem angegebenen Zeichenzeiger beginnen, in eine Abfolge von Bytes, die ab dem angegebenen Bytezeiger gespeichert werden.
public:
override int GetBytes(char* chars, int charCount, System::Byte* bytes, int byteCount);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount);
[System.CLSCompliant(false)]
public override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
override this.GetBytes : nativeptr<char> * int * nativeptr<byte> * int -> int
[<System.CLSCompliant(false)>]
override this.GetBytes : nativeptr<char> * int * nativeptr<byte> * int -> int
Parameter
- chars
- Char*
Ein Zeiger auf das erste zeichen, das codiert werden soll.
- charCount
- Int32
Die Anzahl der zu codierenden Zeichen.
- bytes
- Byte*
Ein Zeiger auf die Position, an der die resultierende Folge von Bytes geschrieben werden soll.
- byteCount
- Int32
Die maximale Anzahl von Bytes, die geschrieben werden sollen.
Gibt zurück
Die tatsächliche Anzahl von Bytes, die an der position geschrieben wurden, die durch den bytes Parameter angegeben wurde.
- Attribute
Ausnahmen
charCount oder byteCount ist kleiner als Null.
Fehlererkennung ist aktiviert und chars enthält eine ungültige Abfolge von Zeichen.
-oder-
byteCount ist kleiner als die resultierende Anzahl von Bytes.
Ein Fallback ist aufgetreten (weitere Informationen finden Sie unter "Zeichencodierung in .NET")
-und-
EncoderFallback ist auf EncoderExceptionFallback festgelegt.
Hinweise
Um die genaue Arraygröße zu berechnen, die zum GetBytes Speichern der resultierenden Bytes erforderlich ist, rufen Sie die GetByteCount Methode auf. Um die maximale Arraygröße zu berechnen, rufen Sie die GetMaxByteCount Methode auf. Die GetByteCount Methode weist in der Regel weniger Arbeitsspeicher zu, während die GetMaxByteCount Methode im Allgemeinen schneller ausgeführt wird.
Bei der Fehlererkennung führt eine ungültige Sequenz dazu, dass diese Methode eine ArgumentException. Ohne Fehlererkennung werden ungültige Sequenzen ignoriert, und es wird keine Ausnahme ausgelöst.
Daten, die konvertiert werden sollen, z. B. Daten, die aus einem Datenstrom gelesen werden, sind möglicherweise nur in sequenziellen Blöcken verfügbar. In diesem Fall oder wenn die Datenmenge so groß ist, dass sie in kleinere Blöcke unterteilt werden muss, verwendet die Anwendung die Decoder oder die Encoder von der GetDecoder Methode bzw. methode GetEncoder bereitgestellte.
Important
Um sicherzustellen, dass die codierten Bytes ordnungsgemäß decodiert werden, wenn sie als Datei oder als Datenstrom gespeichert werden, können Sie einem Datenstrom codierter Bytes ein Präambel voranstellen. Das Einfügen eines Präambels am Anfang eines Bytestreams (z. B. am Anfang einer Reihe von Bytes, die in eine Datei geschrieben werden sollen) liegt in der Verantwortung des Entwicklers. Die GetBytes Methode stellt keinen Präambel am Anfang einer Sequenz codierter Bytes voran.
Weitere Informationen
Gilt für:
GetBytes(Char[], Int32, Int32, Byte[], Int32)
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
Codiert eine Reihe von Zeichen aus dem angegebenen Zeichenarray in das angegebene Bytearray.
public:
override int GetBytes(cli::array <char> ^ chars, int charIndex, int charCount, cli::array <System::Byte> ^ bytes, int byteIndex);
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex);
override this.GetBytes : char[] * int * int * byte[] * int -> int
Public Overrides Function GetBytes (chars As Char(), charIndex As Integer, charCount As Integer, bytes As Byte(), byteIndex As Integer) As Integer
Parameter
- chars
- Char[]
Das Zeichenarray, das die zu codierenden Zeichensätze enthält.
- charIndex
- Int32
Der Index des ersten zu codierenden Zeichens.
- charCount
- Int32
Die Anzahl der zu codierenden Zeichen.
- bytes
- Byte[]
Das Bytearray, das die resultierende Folge von Bytes enthält.
- byteIndex
- Int32
Der Index, bei dem mit dem Schreiben der resultierenden Bytesequenz begonnen werden soll.
Gibt zurück
Die tatsächliche Anzahl der in bytes.
Ausnahmen
charIndex oder charCountbyteIndex ist kleiner als Null.
-oder-
charIndex und charCount keinen gültigen Bereich in chars.
-oder-
byteIndex ist kein gültiger Index in bytes.
Fehlererkennung ist aktiviert und chars enthält eine ungültige Abfolge von Zeichen.
-oder-
bytes verfügt nicht über genügend Kapazität vom byteIndex Ende des Arrays, um die resultierenden Bytes aufzunehmen.
Ein Fallback ist aufgetreten (weitere Informationen finden Sie unter "Zeichencodierung in .NET")
-und-
EncoderFallback ist auf EncoderExceptionFallback festgelegt.
Beispiele
Im folgenden Beispiel wird die Anzahl der Bytes bestimmt, die zum Codieren von drei Zeichen aus einem Zeichenarray erforderlich sind, und anschließend werden die Zeichen codiert und die resultierenden Bytes angezeigt.
using System;
using System.Text;
public class SamplesUTF32Encoding {
public static void Main() {
// The characters to encode:
// Latin Small Letter Z (U+007A)
// Latin Small Letter A (U+0061)
// Combining Breve (U+0306)
// Latin Small Letter AE With Acute (U+01FD)
// Greek Small Letter Beta (U+03B2)
// a high-surrogate value (U+D8FF)
// a low-surrogate value (U+DCFF)
char[] myChars = new char[7] { 'z', 'a', '\u0306', '\u01FD', '\u03B2', '\uD8FF', '\uDCFF' };
// Create instances of different encodings.
UTF7Encoding u7 = new UTF7Encoding();
UTF8Encoding u8Nobom = new UTF8Encoding( false, true );
UTF8Encoding u8Bom = new UTF8Encoding( true, true );
UTF32Encoding u32Nobom = new UTF32Encoding( false, false, true );
UTF32Encoding u32Bom = new UTF32Encoding( false, true, true );
// Encode three characters starting at index 4 and print out the counts and the resulting bytes.
PrintCountsAndBytes( myChars, 4, 3, u7 );
PrintCountsAndBytes( myChars, 4, 3, u8Nobom );
PrintCountsAndBytes( myChars, 4, 3, u8Bom );
PrintCountsAndBytes( myChars, 4, 3, u32Nobom );
PrintCountsAndBytes( myChars, 4, 3, u32Bom );
}
public static void PrintCountsAndBytes( char[] chars, int index, int count, Encoding enc ) {
// Display the name of the encoding used.
Console.Write( "{0,-25} :", enc.ToString() );
// Display the exact byte count.
int iBC = enc.GetByteCount( chars, index, count );
Console.Write( " {0,-3}", iBC );
// Display the maximum byte count.
int iMBC = enc.GetMaxByteCount( count );
Console.Write( " {0,-3} :", iMBC );
// Get the byte order mark, if any.
byte[] preamble = enc.GetPreamble();
// Combine the preamble and the encoded bytes.
byte[] bytes = new byte[preamble.Length + iBC];
Array.Copy( preamble, bytes, preamble.Length );
enc.GetBytes( chars, index, count, bytes, preamble.Length );
// Display all the encoded bytes.
PrintHexBytes( bytes );
}
public static void PrintHexBytes( byte[] bytes ) {
if (( bytes == null ) || ( bytes.Length == 0 ))
{
Console.WriteLine( "<none>" );
}
else {
for ( int i = 0; i < bytes.Length; i++ )
Console.Write( "{0:X2} ", bytes[i] );
Console.WriteLine();
}
}
}
/*
This code produces the following output.
System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D
System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF
System.Text.UTF8Encoding : 6 12 :EF BB BF CE B2 F1 8F B3 BF
System.Text.UTF32Encoding : 8 12 :B2 03 00 00 FF FC 04 00
System.Text.UTF32Encoding : 8 12 :FF FE 00 00 B2 03 00 00 FF FC 04 00
*/
Imports System.Text
Public Class SamplesUTF32Encoding
Public Shared Sub Main()
' The characters to encode:
' Latin Small Letter Z (U+007A)
' Latin Small Letter A (U+0061)
' Combining Breve (U+0306)
' Latin Small Letter AE With Acute (U+01FD)
' Greek Small Letter Beta (U+03B2)
' a high-surrogate value (U+D8FF)
' a low-surrogate value (U+DCFF)
Dim myChars() As Char = {"z"c, "a"c, ChrW(&H0306), ChrW(&H01FD), ChrW(&H03B2), ChrW(&HD8FF), ChrW(&HDCFF)}
' Create instances of different encodings.
Dim u7 As New UTF7Encoding()
Dim u8Nobom As New UTF8Encoding(False, True)
Dim u8Bom As New UTF8Encoding(True, True)
Dim u32Nobom As New UTF32Encoding(False, False, True)
Dim u32Bom As New UTF32Encoding(False, True, True)
' Encode three characters starting at index 4 and print out the counts and the resulting bytes.
PrintCountsAndBytes(myChars, 4, 3, u7)
PrintCountsAndBytes(myChars, 4, 3, u8Nobom)
PrintCountsAndBytes(myChars, 4, 3, u8Bom)
PrintCountsAndBytes(myChars, 4, 3, u32Nobom)
PrintCountsAndBytes(myChars, 4, 3, u32Bom)
End Sub
Public Shared Sub PrintCountsAndBytes(chars() As Char, index As Integer, count As Integer, enc As Encoding)
' Display the name of the encoding used.
Console.Write("{0,-25} :", enc.ToString())
' Display the exact byte count.
Dim iBC As Integer = enc.GetByteCount(chars, index, count)
Console.Write(" {0,-3}", iBC)
' Display the maximum byte count.
Dim iMBC As Integer = enc.GetMaxByteCount(count)
Console.Write(" {0,-3} :", iMBC)
' Get the byte order mark, if any.
Dim preamble As Byte() = enc.GetPreamble()
' Combine the preamble and the encoded bytes.
' NOTE: In Visual Basic, arrays contain one extra element by default.
' The following line creates an array with the exact number of elements required.
Dim bytes(preamble.Length + iBC - 1) As Byte
Array.Copy(preamble, bytes, preamble.Length)
enc.GetBytes(chars, index, count, bytes, preamble.Length)
' Display all the encoded bytes.
PrintHexBytes(bytes)
End Sub
Public Shared Sub PrintHexBytes(bytes() As Byte)
If bytes Is Nothing OrElse bytes.Length = 0 Then
Console.WriteLine("<none>")
Else
Dim i As Integer
For i = 0 To bytes.Length - 1
Console.Write("{0:X2} ", bytes(i))
Next i
Console.WriteLine()
End If
End Sub
End Class
'This code produces the following output.
'
'System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D
'System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF
'System.Text.UTF8Encoding : 6 12 :EF BB BF CE B2 F1 8F B3 BF
'System.Text.UTF32Encoding : 8 12 :B2 03 00 00 FF FC 04 00
'System.Text.UTF32Encoding : 8 12 :FF FE 00 00 B2 03 00 00 FF FC 04 00
Hinweise
Um die genaue Arraygröße zu berechnen, die zum GetBytes Speichern der resultierenden Bytes erforderlich ist, rufen Sie die GetByteCount Methode auf. Um die maximale Arraygröße zu berechnen, rufen Sie die GetMaxByteCount Methode auf. Die GetByteCount Methode weist in der Regel weniger Arbeitsspeicher zu, während die GetMaxByteCount Methode im Allgemeinen schneller ausgeführt wird.
Bei der Fehlererkennung führt eine ungültige Sequenz dazu, dass diese Methode eine ArgumentException. Ohne Fehlererkennung werden ungültige Sequenzen ignoriert, und es wird keine Ausnahme ausgelöst.
Daten, die konvertiert werden sollen, z. B. Daten, die aus einem Datenstrom gelesen werden, sind möglicherweise nur in sequenziellen Blöcken verfügbar. In diesem Fall oder wenn die Datenmenge so groß ist, dass sie in kleinere Blöcke unterteilt werden muss, verwendet die Anwendung die Decoder oder die Encoder von der GetDecoder Methode bzw. methode GetEncoder bereitgestellte.
Important
Um sicherzustellen, dass die codierten Bytes ordnungsgemäß decodiert werden, wenn sie als Datei oder als Datenstrom gespeichert werden, können Sie einem Datenstrom codierter Bytes ein Präambel voranstellen. Das Einfügen eines Präambels am Anfang eines Bytestreams (z. B. am Anfang einer Reihe von Bytes, die in eine Datei geschrieben werden sollen) liegt in der Verantwortung des Entwicklers. Die GetBytes Methode stellt keinen Präambel am Anfang einer Sequenz codierter Bytes voran.
Weitere Informationen
Gilt für:
GetBytes(String, Int32, Int32, Byte[], Int32)
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
- Quelle:
- UTF32Encoding.cs
Codiert eine Reihe von Zeichen aus dem angegebenen String Bytearray.
public:
override int GetBytes(System::String ^ s, int charIndex, int charCount, cli::array <System::Byte> ^ bytes, int byteIndex);
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex);
override this.GetBytes : string * int * int * byte[] * int -> int
Public Overrides Function GetBytes (s As String, charIndex As Integer, charCount As Integer, bytes As Byte(), byteIndex As Integer) As Integer
Parameter
- charIndex
- Int32
Der Index des ersten zu codierenden Zeichens.
- charCount
- Int32
Die Anzahl der zu codierenden Zeichen.
- bytes
- Byte[]
Das Bytearray, das die resultierende Folge von Bytes enthält.
- byteIndex
- Int32
Der Index, bei dem mit dem Schreiben der resultierenden Bytesequenz begonnen werden soll.
Gibt zurück
Die tatsächliche Anzahl der in bytes.
Ausnahmen
charIndex oder charCountbyteIndex ist kleiner als Null.
-oder-
charIndex und charCount keinen gültigen Bereich in s.
-oder-
byteIndex ist kein gültiger Index in bytes.
Fehlererkennung ist aktiviert und s enthält eine ungültige Abfolge von Zeichen.
-oder-
bytes verfügt nicht über genügend Kapazität vom byteIndex Ende des Arrays, um die resultierenden Bytes aufzunehmen.
Ein Fallback ist aufgetreten (weitere Informationen finden Sie unter "Zeichencodierung in .NET")
-und-
EncoderFallback ist auf EncoderExceptionFallback festgelegt.
Beispiele
Im folgenden Beispiel wird die Anzahl der Bytes bestimmt, die zum Codieren einer Zeichenfolge erforderlich sind, und anschließend die Zeichenfolge codiert und die resultierenden Bytes angezeigt.
using System;
using System.Text;
public class SamplesUTF32Encoding {
public static void Main() {
// The characters to encode:
// Latin Small Letter Z (U+007A)
// Latin Small Letter A (U+0061)
// Combining Breve (U+0306)
// Latin Small Letter AE With Acute (U+01FD)
// Greek Small Letter Beta (U+03B2)
// a high-surrogate value (U+D8FF)
// a low-surrogate value (U+DCFF)
String myStr = "za\u0306\u01FD\u03B2\uD8FF\uDCFF";
// Create instances of different encodings.
UTF7Encoding u7 = new UTF7Encoding();
UTF8Encoding u8Nobom = new UTF8Encoding( false, true );
UTF8Encoding u8Bom = new UTF8Encoding( true, true );
UTF32Encoding u32Nobom = new UTF32Encoding( false, false, true );
UTF32Encoding u32Bom = new UTF32Encoding( false, true, true );
// Get the byte counts and the bytes.
PrintCountsAndBytes( myStr, u7 );
PrintCountsAndBytes( myStr, u8Nobom );
PrintCountsAndBytes( myStr, u8Bom );
PrintCountsAndBytes( myStr, u32Nobom );
PrintCountsAndBytes( myStr, u32Bom );
}
public static void PrintCountsAndBytes( String s, Encoding enc ) {
// Display the name of the encoding used.
Console.Write( "{0,-25} :", enc.ToString() );
// Display the exact byte count.
int iBC = enc.GetByteCount( s );
Console.Write( " {0,-3}", iBC );
// Display the maximum byte count.
int iMBC = enc.GetMaxByteCount( s.Length );
Console.Write( " {0,-3} :", iMBC );
// Get the byte order mark, if any.
byte[] preamble = enc.GetPreamble();
// Combine the preamble and the encoded bytes.
byte[] bytes = new byte[preamble.Length + iBC];
Array.Copy( preamble, bytes, preamble.Length );
enc.GetBytes( s, 0, s.Length, bytes, preamble.Length );
// Display all the encoded bytes.
PrintHexBytes( bytes );
}
public static void PrintHexBytes( byte[] bytes ) {
if (( bytes == null ) || ( bytes.Length == 0 ))
{
Console.WriteLine( "<none>" );
}
else {
for ( int i = 0; i < bytes.Length; i++ )
Console.Write( "{0:X2} ", bytes[i] );
Console.WriteLine();
}
}
}
/*
This code produces the following output.
System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
System.Text.UTF8Encoding : 12 24 :EF BB BF 7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
System.Text.UTF32Encoding : 24 28 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
System.Text.UTF32Encoding : 24 28 :FF FE 00 00 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
*/
Imports System.Text
Public Class SamplesUTF32Encoding
Public Shared Sub Main()
' The characters to encode:
' Latin Small Letter Z (U+007A)
' Latin Small Letter A (U+0061)
' Combining Breve (U+0306)
' Latin Small Letter AE With Acute (U+01FD)
' Greek Small Letter Beta (U+03B2)
' a high-surrogate value (U+D8FF)
' a low-surrogate value (U+DCFF)
Dim myStr As String = "za" & ChrW(&H0306) & ChrW(&H01FD) & ChrW(&H03B2) & ChrW(&HD8FF) & ChrW(&HDCFF)
' Create instances of different encodings.
Dim u7 As New UTF7Encoding()
Dim u8Nobom As New UTF8Encoding(False, True)
Dim u8Bom As New UTF8Encoding(True, True)
Dim u32Nobom As New UTF32Encoding(False, False, True)
Dim u32Bom As New UTF32Encoding(False, True, True)
' Get the byte counts and the bytes.
PrintCountsAndBytes(myStr, u7)
PrintCountsAndBytes(myStr, u8Nobom)
PrintCountsAndBytes(myStr, u8Bom)
PrintCountsAndBytes(myStr, u32Nobom)
PrintCountsAndBytes(myStr, u32Bom)
End Sub
Public Shared Sub PrintCountsAndBytes(s As String, enc As Encoding)
' Display the name of the encoding used.
Console.Write("{0,-25} :", enc.ToString())
' Display the exact byte count.
Dim iBC As Integer = enc.GetByteCount(s)
Console.Write(" {0,-3}", iBC)
' Display the maximum byte count.
Dim iMBC As Integer = enc.GetMaxByteCount(s.Length)
Console.Write(" {0,-3} :", iMBC)
' Get the byte order mark, if any.
Dim preamble As Byte() = enc.GetPreamble()
' Combine the preamble and the encoded bytes.
' NOTE: In Visual Basic, arrays contain one extra element by default.
' The following line creates an array with the exact number of elements required.
Dim bytes(preamble.Length + iBC - 1) As Byte
Array.Copy(preamble, bytes, preamble.Length)
enc.GetBytes(s, 0, s.Length, bytes, preamble.Length)
' Display all the encoded bytes.
PrintHexBytes(bytes)
End Sub
Public Shared Sub PrintHexBytes(bytes() As Byte)
If bytes Is Nothing OrElse bytes.Length = 0 Then
Console.WriteLine("<none>")
Else
Dim i As Integer
For i = 0 To bytes.Length - 1
Console.Write("{0:X2} ", bytes(i))
Next i
Console.WriteLine()
End If
End Sub
End Class
'This code produces the following output.
'
'System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
'System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'System.Text.UTF8Encoding : 12 24 :EF BB BF 7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
'System.Text.UTF32Encoding : 24 28 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
'System.Text.UTF32Encoding : 24 28 :FF FE 00 00 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
Hinweise
Um die genaue Arraygröße zu berechnen, die zum GetBytes Speichern der resultierenden Bytes erforderlich ist, rufen Sie die GetByteCount Methode auf. Um die maximale Arraygröße zu berechnen, rufen Sie die GetMaxByteCount Methode auf. Die GetByteCount Methode weist in der Regel weniger Arbeitsspeicher zu, während die GetMaxByteCount Methode im Allgemeinen schneller ausgeführt wird.
Bei der Fehlererkennung führt eine ungültige Sequenz dazu, dass diese Methode eine ArgumentException. Ohne Fehlererkennung werden ungültige Sequenzen ignoriert, und es wird keine Ausnahme ausgelöst.
Daten, die konvertiert werden sollen, z. B. Daten, die aus einem Datenstrom gelesen werden, sind möglicherweise nur in sequenziellen Blöcken verfügbar. In diesem Fall oder wenn die Datenmenge so groß ist, dass sie in kleinere Blöcke unterteilt werden muss, verwendet die Anwendung die Decoder oder die Encoder von der GetDecoder Methode bzw. methode GetEncoder bereitgestellte.
Important
Um sicherzustellen, dass die codierten Bytes ordnungsgemäß decodiert werden, wenn sie als Datei oder als Datenstrom gespeichert werden, können Sie einem Datenstrom codierter Bytes ein Präambel voranstellen. Das Einfügen eines Präambels am Anfang eines Bytestreams (z. B. am Anfang einer Reihe von Bytes, die in eine Datei geschrieben werden sollen) liegt in der Verantwortung des Entwicklers. Die GetBytes Methode stellt keinen Präambel am Anfang einer Sequenz codierter Bytes voran.