Decoder.GetCharCount 메서드

정의

파생 클래스에서 재정의되면 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다.

오버로드

GetCharCount(ReadOnlySpan<Byte>, Boolean)

파생 클래스에서 재정의할 경우, 범위 내의 바이트 시퀀스를 디코딩 하여 생성되는 문자 수를 계산합니다. 매개 변수는 계산 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

GetCharCount(Byte*, Int32, Boolean)

파생 클래스에서 재정의되면 지정한 바이트 포인터에서 시작하는 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다. 매개 변수는 계산 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

GetCharCount(Byte[], Int32, Int32)

파생 클래스에서 재정의되면 지정한 바이트 배열의 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다.

GetCharCount(Byte[], Int32, Int32, Boolean)

파생 클래스에서 재정의되면 지정한 바이트 배열의 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다. 매개 변수는 계산 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

GetCharCount(ReadOnlySpan<Byte>, Boolean)

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

파생 클래스에서 재정의할 경우, 범위 내의 바이트 시퀀스를 디코딩 하여 생성되는 문자 수를 계산합니다. 매개 변수는 계산 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

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

매개 변수

bytes
ReadOnlySpan<Byte>

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

flush
Boolean

계산 후 인코더의 내부 상태를 지우도록 시뮬레이션하려면 true, 그러지 않으면 false입니다.

반환

지정한 바이트 시퀀스 및 내부 버퍼의 모든 바이트를 디코딩할 경우 생성되는 문자 수입니다.

설명

이 메서드는 디코더의 상태에 영향을 주지 않습니다.

정확한 버퍼 크기를 계산 하려면 GetChars 필요한 결과 문자를 저장 하려면 애플리케이션을 사용할지 GetCharCount합니다.

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

적용 대상

GetCharCount(Byte*, Int32, Boolean)

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

중요

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

파생 클래스에서 재정의되면 지정한 바이트 포인터에서 시작하는 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다. 매개 변수는 계산 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

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

매개 변수

bytes
Byte*

디코딩할 첫 번째 바이트를 가리키는 포인터입니다.

count
Int32

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

flush
Boolean

계산 후 인코더의 내부 상태를 지우도록 시뮬레이션하려면 true, 그러지 않으면 false입니다.

반환

지정한 바이트 시퀀스 및 내부 버퍼의 모든 바이트를 디코딩할 경우 생성되는 문자 수입니다.

특성

예외

bytesnull(Visual Basic .NET의 경우 Nothing)입니다.

count가 0보다 작은 경우

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

FallbackDecoderExceptionFallback로 설정됩니다.

설명

이 메서드는 디코더의 상태에 영향을 주지 않습니다.

정확한 배열 크기를 계산 하려면 GetChars 필요한 결과 문자를 저장 하려면 애플리케이션을 사용할지 GetCharCount합니다.

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

추가 정보

적용 대상

GetCharCount(Byte[], Int32, Int32)

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

파생 클래스에서 재정의되면 지정한 바이트 배열의 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다.

public:
 abstract int GetCharCount(cli::array <System::Byte> ^ bytes, int index, int count);
public abstract int GetCharCount (byte[] bytes, int index, int count);
abstract member GetCharCount : byte[] * int * int -> int
Public MustOverride Function GetCharCount (bytes As Byte(), index As Integer, count As Integer) As Integer

매개 변수

bytes
Byte[]

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

index
Int32

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

count
Int32

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

반환

지정한 바이트 시퀀스 및 내부 버퍼의 모든 바이트를 디코딩할 경우 생성되는 문자 수입니다.

예외

bytesnull(Nothing)입니다.

index 또는 count가 0보다 작습니다.

또는

indexcountbytes에서 올바른 범위를 나타내지 않습니다.

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

FallbackDecoderExceptionFallback로 설정됩니다.

예제

다음 코드 예제를 사용 GetCharCount 하는 방법에 설명 합니다 배열에서 지정된된 바이트 범위를 디코딩 하는 데 필요한 문자 수를 계산 하는 방법입니다.

using namespace System;
using namespace System::Text;
int main()
{
   array<Byte>^bytes = {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 );
   Console::WriteLine( "{0} characters needed to decode bytes.", charCount );
}

/* This code example produces the following output.

7 characters needed to decode bytes.

*/
using System;
using System.Text;

class DecoderExample {
    public static void Main() {
        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);
        Console.WriteLine(
            "{0} characters needed to decode bytes.", charCount
        );
    }
}

/* This code example produces the following output.

7 characters needed to decode bytes.

*/
Imports System.Text

Class DecoderExample
    
    Public Shared Sub Main()
        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)
        Console.WriteLine("{0} characters needed to decode bytes.", charCount)
    End Sub
End Class

'This code example produces the following output.
'
'7 characters needed to decode bytes.
'

설명

이 메서드는 디코더의 상태에 영향을 주지 않습니다.

정확한 배열 크기를 계산 하려면 GetChars 필요한 결과 문자를 저장 하려면 애플리케이션을 사용할지 GetCharCount합니다.

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

추가 정보

적용 대상

GetCharCount(Byte[], Int32, Int32, Boolean)

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

파생 클래스에서 재정의되면 지정한 바이트 배열의 바이트 시퀀스를 디코딩하여 생성되는 문자 수를 계산합니다. 매개 변수는 계산 후 디코더의 내부 상태를 지울지 여부를 나타냅니다.

public:
 virtual int GetCharCount(cli::array <System::Byte> ^ bytes, int index, int count, bool flush);
public virtual int GetCharCount (byte[] bytes, int index, int count, bool flush);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual int GetCharCount (byte[] bytes, int index, int count, bool flush);
abstract member GetCharCount : byte[] * int * int * bool -> int
override this.GetCharCount : byte[] * int * int * bool -> int
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member GetCharCount : byte[] * int * int * bool -> int
override this.GetCharCount : byte[] * int * int * bool -> int
Public Overridable Function GetCharCount (bytes As Byte(), index As Integer, count As Integer, flush As Boolean) As Integer

매개 변수

bytes
Byte[]

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

index
Int32

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

count
Int32

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

flush
Boolean

계산 후 인코더의 내부 상태를 지우도록 시뮬레이션하려면 true, 그러지 않으면 false입니다.

반환

지정한 바이트 시퀀스 및 내부 버퍼의 모든 바이트를 디코딩할 경우 생성되는 문자 수입니다.

특성

예외

bytesnull(Nothing)입니다.

index 또는 count가 0보다 작습니다.

또는

indexcountbytes에서 올바른 범위를 나타내지 않습니다.

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

FallbackDecoderExceptionFallback로 설정됩니다.

설명

이 메서드는 디코더의 상태에 영향을 주지 않습니다.

정확한 배열 크기를 계산 하려면 GetChars 필요한 결과 문자를 저장 하려면 애플리케이션을 사용할지 GetCharCount합니다.

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

추가 정보

적용 대상