Decoder.GetChars 메서드

정의

파생 클래스에서 재정의되는 경우 바이트 시퀀스를 문자 집합으로 디코딩합니다.

오버로드

Name Description
GetChars(ReadOnlySpan<Byte>, Span<Char>, Boolean)

파생 클래스에서 재정의되는 경우 내부 버퍼의 범위 바이트 및 바이트 시퀀스를 지정된 문자 포인터에서 시작하여 저장되는 문자 집합으로 디코딩합니다. 매개 변수는 변환 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

GetChars(Byte*, Int32, Char*, Int32, Boolean)

파생 클래스에서 재정의되는 경우 지정된 바이트 포인터에서 시작하는 바이트 시퀀스와 내부 버퍼의 바이트를 지정된 문자 포인터에서 시작하여 저장되는 문자 집합으로 디코딩합니다. 매개 변수는 변환 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

GetChars(Byte[], Int32, Int32, Char[], Int32)

파생 클래스에서 재정의되는 경우 지정된 바이트 배열의 바이트 시퀀스와 내부 버퍼의 바이트를 지정된 문자 배열로 디코딩합니다.

GetChars(Byte[], Int32, Int32, Char[], Int32, Boolean)

파생 클래스에서 재정의되는 경우 지정된 바이트 배열의 바이트 시퀀스와 내부 버퍼의 바이트를 지정된 문자 배열로 디코딩합니다. 매개 변수는 변환 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

GetChars(ReadOnlySpan<Byte>, Span<Char>, Boolean)

Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs

파생 클래스에서 재정의되는 경우 내부 버퍼의 범위 바이트 및 바이트 시퀀스를 지정된 문자 포인터에서 시작하여 저장되는 문자 집합으로 디코딩합니다. 매개 변수는 변환 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

public:
 virtual int GetChars(ReadOnlySpan<System::Byte> bytes, Span<char> chars, bool flush);
public virtual int GetChars(ReadOnlySpan<byte> bytes, Span<char> chars, bool flush);
abstract member GetChars : ReadOnlySpan<byte> * Span<char> * bool -> int
override this.GetChars : ReadOnlySpan<byte> * Span<char> * bool -> int
Public Overridable Function GetChars (bytes As ReadOnlySpan(Of Byte), chars As Span(Of Char), flush As Boolean) As Integer

매개 변수

bytes
ReadOnlySpan<Byte>

디코딩할 바이트 범위입니다.

chars
Span<Char>

결과 문자 집합을 작성하는 범위입니다.

flush
Boolean

true변환 후 디코더의 내부 상태를 지우려면 그렇지 않으면 . false

반품

매개 변수로 표시된 범위에 기록된 실제 문자 수 chars 입니다.

설명

개체는 Decoder 호출 사이에 GetChars상태를 저장합니다. 애플리케이션이 데이터 스트림으로 완료되면 상태 정보가 플러시되도록 매개 변수 flush 를 설정 true 해야 합니다. 이 설정을 사용하면 디코더가 데이터 블록 끝에 있는 잘못된 바이트를 무시하고 내부 버퍼를 지웁니다.

결과 문자를 저장해야 하는 GetChars 정확한 범위 크기를 계산하려면 애플리케이션에서 사용해야 GetCharCount합니다.

set를 사용하여 GetChars호출 flush 되는 경우 false 디코더는 내부 버퍼의 데이터 블록 끝에 후행 바이트를 저장하고 다음 디코딩 작업에서 사용합니다. 애플리케이션은 이전 블록의 후행 바이트가 계산에 포함되도록 동일한 블록에서 호출하기 직전에 데이터 블록을 호출 GetCharCountGetChars 해야 합니다.

애플리케이션이 입력 스트림의 여러 세그먼트를 변환하는 경우 메서드를 사용하는 것이 Convert 좋습니다. GetChars 는 출력 범위가 충분히 Convert 크지 않지만 가능한 한 많은 공간을 채우고 출력 배열에서 두 개 이상의 문자를 허용하는 경우 읽기 및 문자가 기록된 바이트를 반환하는 경우 예외를 throw합니다. 또한 더 많은 의견에 대한 항목을 참조 Encoding.GetChars 하세요.

적용 대상

GetChars(Byte*, Int32, Char*, Int32, Boolean)

Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs

Important

이 API는 CLS 규격이 아닙니다.

파생 클래스에서 재정의되는 경우 지정된 바이트 포인터에서 시작하는 바이트 시퀀스와 내부 버퍼의 바이트를 지정된 문자 포인터에서 시작하여 저장되는 문자 집합으로 디코딩합니다. 매개 변수는 변환 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

public:
 virtual int GetChars(System::Byte* bytes, int byteCount, char* chars, int charCount, bool flush);
[System.CLSCompliant(false)]
public virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush);
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
public virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush);
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush);
[<System.CLSCompliant(false)>]
abstract member GetChars : nativeptr<byte> * int * nativeptr<char> * int * bool -> int
override this.GetChars : nativeptr<byte> * int * nativeptr<char> * int * bool -> int
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member GetChars : nativeptr<byte> * int * nativeptr<char> * int * bool -> int
override this.GetChars : nativeptr<byte> * int * nativeptr<char> * int * bool -> int
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member GetChars : nativeptr<byte> * int * nativeptr<char> * int * bool -> int
override this.GetChars : nativeptr<byte> * int * nativeptr<char> * int * bool -> int

매개 변수

bytes
Byte*

디코딩할 첫 번째 바이트에 대한 포인터입니다.

byteCount
Int32

디코딩할 바이트 수입니다.

chars
Char*

결과 문자 집합 작성을 시작할 위치에 대한 포인터입니다.

charCount
Int32

쓸 최대 문자 수입니다.

flush
Boolean

true변환 후 디코더의 내부 상태를 지우려면 그렇지 않으면 . false

반품

매개 변수가 나타내는 위치에 기록된 실제 문자 수 chars 입니다.

특성

예외

bytes는 (null)입니다 Nothing .

-또는-

chars는 (null)입니다 Nothing .

byteCount 또는 charCount 0보다 작습니다.

charCount 가 결과 문자 수보다 작습니다.

대체가 발생했습니다(자세한 내용은 .NET의 문자 인코딩 참조).

-그리고-

FallbackDecoderExceptionFallback로 설정됩니다.

설명

개체는 Decoder 호출 사이에 GetChars상태를 저장합니다. 애플리케이션이 데이터 스트림으로 완료되면 상태 정보가 플러시되도록 매개 변수 flush 를 설정 true 해야 합니다. 이 설정을 사용하면 디코더가 데이터 블록 끝에 있는 잘못된 바이트를 무시하고 내부 버퍼를 지웁니다.

결과 문자를 저장해야 하는 GetChars 정확한 버퍼 크기를 계산하려면 애플리케이션에서 사용해야 GetCharCount합니다.

set를 사용하여 GetChars호출 flush 되는 경우 false 디코더는 내부 버퍼의 데이터 블록 끝에 후행 바이트를 저장하고 다음 디코딩 작업에서 사용합니다. 애플리케이션은 이전 블록의 후행 바이트가 계산에 포함되도록 동일한 블록에서 호출하기 직전에 데이터 블록을 호출 GetCharCountGetChars 해야 합니다.

애플리케이션이 입력 스트림의 여러 세그먼트를 변환하는 경우 메서드를 사용하는 것이 Convert 좋습니다. GetChars 는 출력 버퍼가 충분히 크지 않은 경우 예외를 throw하지만 Convert 출력 배열에서 두 개 이상의 문자를 허용하는 경우 가능한 한 많은 공간을 채우고 쓴 바이트 및 문자를 반환합니다. 또한 더 많은 의견에 대한 항목을 참조 Encoding.GetChars 하세요.

추가 정보

적용 대상

GetChars(Byte[], Int32, Int32, Char[], Int32)

Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs

파생 클래스에서 재정의되는 경우 지정된 바이트 배열의 바이트 시퀀스와 내부 버퍼의 바이트를 지정된 문자 배열로 디코딩합니다.

public:
 abstract int GetChars(cli::array <System::Byte> ^ bytes, int byteIndex, int byteCount, cli::array <char> ^ chars, int charIndex);
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
abstract member GetChars : byte[] * int * int * char[] * int -> int
Public MustOverride Function GetChars (bytes As Byte(), byteIndex As Integer, byteCount As Integer, chars As Char(), charIndex As Integer) As Integer

매개 변수

bytes
Byte[]

디코딩할 바이트 시퀀스를 포함하는 바이트 배열입니다.

byteIndex
Int32

디코딩할 첫 번째 바이트의 인덱스입니다.

byteCount
Int32

디코딩할 바이트 수입니다.

chars
Char[]

결과 문자 집합을 포함할 문자 배열입니다.

charIndex
Int32

결과 문자 집합을 쓰기 시작할 인덱스입니다.

반품

로 작성된 실제 문자 수입니다 chars.

예외

bytes는 (null)입니다 Nothing .

-또는-

chars는 (null)입니다 Nothing .

byteIndex 또는 byteCountcharIndex 0보다 작습니다.

-또는-

byteIndex 에서 byteCount 유효한 범위를 bytes나타내지 않습니다.

-또는-

charIndex에서 유효한 인덱스가 아닌 경우 chars

chars 에는 결과 문자를 수용할 수 있는 충분한 용량 charIndex 이 없습니다.

대체가 발생했습니다(자세한 내용은 .NET의 문자 인코딩 참조).

-그리고-

FallbackDecoderExceptionFallback로 설정됩니다.

예제

다음 예제에서는 바이트 배열의 요소 범위를 디코딩하고 유니코드 문자 배열에 저장하는 방법을 보여 줍니다. 이 GetCharCount 메서드는 디코딩된 요소를 배열 bytes에 저장하는 데 필요한 문자 수를 계산하는 데 사용됩니다. 메서드는 GetChars 바이트 배열에서 지정된 요소를 디코딩하고 새 문자 배열에 저장합니다.

using System;
using System.Text;

class UnicodeEncodingExample {
    public static void Main() {
        Char[] chars;
        Byte[] bytes = new Byte[] {
            85, 0, 110, 0, 105, 0, 99, 0, 111, 0, 100, 0, 101, 0
        };

        Decoder uniDecoder = Encoding.Unicode.GetDecoder();

        int charCount = uniDecoder.GetCharCount(bytes, 0, bytes.Length);
        chars = new Char[charCount];
        int charsDecodedCount = uniDecoder.GetChars(bytes, 0, bytes.Length, chars, 0);

        Console.WriteLine(
            "{0} characters used to decode bytes.", charsDecodedCount
        );

        Console.Write("Decoded chars: ");
        foreach (Char c in chars) {
            Console.Write("[{0}]", c);
        }
        Console.WriteLine();
    }
}

/* This code example produces the following output.

7 characters used to decode bytes.
Decoded chars: [U][n][i][c][o][d][e]

*/
Imports System.Text

Class UnicodeEncodingExample
    
    Public Shared Sub Main()
        Dim chars() As Char
        Dim bytes() As Byte = { _
            85, 0, 110, 0, 105, 0, 99, 0, 111, 0, 100, 0, 101, 0 _
        }
        
        Dim uniDecoder As Decoder = Encoding.Unicode.GetDecoder()
        
        Dim charCount As Integer = uniDecoder.GetCharCount(bytes, 0, bytes.Length)
        chars = New Char(charCount - 1) {}
        Dim charsDecodedCount As Integer = _
            uniDecoder.GetChars(bytes, 0, bytes.Length, chars, 0)
        
        Console.WriteLine( _
            "{0} characters used to decode bytes.", _
            charsDecodedCount _
        )
        
        Console.Write("Decoded chars: ")
        Dim c As Char
        For Each c In  chars
            Console.Write("[{0}]", c)
        Next c
        Console.WriteLine()
    End Sub
End Class

'This code example produces the following output.
'
'7 characters used to decode bytes.
'Decoded chars: [U][n][i][c][o][d][e]
'

설명

개체는 Decoder 호출 사이에 GetChars상태를 저장합니다. 애플리케이션이 데이터 스트림으로 완료되면 상태 정보가 플러시되도록 매개 변수 flush 를 설정 true 해야 합니다. 이 설정을 사용하면 디코더가 데이터 블록 끝에 있는 잘못된 바이트를 무시하고 내부 버퍼를 지웁니다.

결과 문자를 저장해야 하는 GetChars 정확한 배열 크기를 계산하려면 애플리케이션에서 .를 사용해야 GetCharCount합니다.

set를 사용하여 GetChars호출 flush 되는 경우 false 디코더는 내부 버퍼의 데이터 블록 끝에 후행 바이트를 저장하고 다음 디코딩 작업에서 사용합니다. 애플리케이션은 이전 블록의 후행 바이트가 계산에 포함되도록 동일한 블록에서 호출하기 직전에 데이터 블록을 호출 GetCharCountGetChars 해야 합니다.

애플리케이션이 입력 스트림의 여러 세그먼트를 변환하는 경우 메서드를 사용하는 것이 Convert 좋습니다. GetChars 는 출력 버퍼가 충분히 크지 않은 경우 예외를 throw하지만 Convert 출력 배열에서 두 개 이상의 문자를 허용하는 경우 가능한 한 많은 공간을 채우고 쓴 바이트 및 문자를 반환합니다. 또한 더 많은 의견에 대한 항목을 참조 Encoding.GetChars 하세요.

추가 정보

적용 대상

GetChars(Byte[], Int32, Int32, Char[], Int32, Boolean)

Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs
Source:
Decoder.cs

파생 클래스에서 재정의되는 경우 지정된 바이트 배열의 바이트 시퀀스와 내부 버퍼의 바이트를 지정된 문자 배열로 디코딩합니다. 매개 변수는 변환 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

public:
 virtual int GetChars(cli::array <System::Byte> ^ bytes, int byteIndex, int byteCount, cli::array <char> ^ chars, int charIndex, bool flush);
public virtual int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush);
abstract member GetChars : byte[] * int * int * char[] * int * bool -> int
override this.GetChars : byte[] * int * int * char[] * int * bool -> int
Public Overridable Function GetChars (bytes As Byte(), byteIndex As Integer, byteCount As Integer, chars As Char(), charIndex As Integer, flush As Boolean) As Integer

매개 변수

bytes
Byte[]

디코딩할 바이트 시퀀스를 포함하는 바이트 배열입니다.

byteIndex
Int32

디코딩할 첫 번째 바이트의 인덱스입니다.

byteCount
Int32

디코딩할 바이트 수입니다.

chars
Char[]

결과 문자 집합을 포함할 문자 배열입니다.

charIndex
Int32

결과 문자 집합을 쓰기 시작할 인덱스입니다.

flush
Boolean

true변환 후 디코더의 내부 상태를 지우려면 그렇지 않으면 . false

반품

매개 변수에 기록된 실제 문자 수입니다 chars .

예외

bytes는 (null)입니다 Nothing .

-또는-

chars는 (null)입니다 Nothing .

byteIndex 또는 byteCountcharIndex 0보다 작습니다.

-또는-

byteIndex 에서 byteCount 유효한 범위를 bytes나타내지 않습니다.

-또는-

charIndex에서 유효한 인덱스가 아닌 경우 chars

chars 에는 결과 문자를 수용할 수 있는 충분한 용량 charIndex 이 없습니다.

대체가 발생했습니다(자세한 내용은 .NET의 문자 인코딩 참조).

-그리고-

FallbackDecoderExceptionFallback로 설정됩니다.

설명

개체는 Decoder 호출 사이에 GetChars상태를 저장합니다. 애플리케이션이 데이터 스트림으로 완료되면 상태 정보가 플러시되도록 매개 변수 flush 를 설정 true 해야 합니다. 이 설정을 사용하면 디코더가 데이터 블록 끝에 있는 잘못된 바이트를 무시하고 내부 버퍼를 지웁니다.

결과 문자를 저장해야 하는 GetChars 정확한 배열 크기를 계산하려면 애플리케이션에서 .를 사용해야 GetCharCount합니다.

set를 사용하여 GetChars호출 flush 되는 경우 false 디코더는 내부 버퍼의 데이터 블록 끝에 후행 바이트를 저장하고 다음 디코딩 작업에서 사용합니다. 애플리케이션은 이전 블록의 후행 바이트가 계산에 포함되도록 동일한 블록에서 호출하기 직전에 데이터 블록을 호출 GetCharCountGetChars 해야 합니다.

애플리케이션이 입력 스트림의 여러 세그먼트를 변환하는 경우 메서드를 사용하는 것이 Convert 좋습니다. GetChars 는 출력 버퍼가 충분히 크지 않은 경우 예외를 throw하지만 Convert 출력 배열에서 두 개 이상의 문자를 허용하는 경우 가능한 한 많은 공간을 채우고 쓴 바이트 및 문자를 반환합니다. 또한 더 많은 의견에 대한 항목을 참조 Encoding.GetChars 하세요.

추가 정보

적용 대상