UTF8Encoding.GetDecoder メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > UTF8Encoding.GetDecoder メソッドの意味・解説 

UTF8Encoding.GetDecoder メソッド

UTF-8エンコードされたバイト シーケンスUnicode 文字シーケンス変換するデコーダ取得します

名前空間: System.Text
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説
使用例使用例

GetDecoder メソッド使用して UTF-8 デコーダ取得する方法次の例に示しますデコーダは、バイト シーケンス文字シーケンス変換します

Imports System
Imports System.Text

Class UTF8EncodingExample
    
    Public Shared Sub Main()
        Dim chars() As Char
        Dim bytes() As Byte
 = {99, 204, 128, 234, 130, 160}
        
        Dim utf8Decoder As Decoder = Encoding.UTF8.GetDecoder()
        
        Dim charCount As Integer
 = utf8Decoder.GetCharCount(bytes, 0, bytes.Length)
        chars = New Char(charCount - 1) {}
        Dim charsDecodedCount As Integer
 = utf8Decoder.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 'Main
End Class 'UTF8EncodingExample
using System;
using System.Text;

class UTF8EncodingExample {
    public static void Main()
 {
        Char[] chars;
        Byte[] bytes = new Byte[] {
            99, 204, 128, 234, 130, 160
        };

        Decoder utf8Decoder = Encoding.UTF8.GetDecoder();

        int charCount = utf8Decoder.GetCharCount(bytes, 0, bytes.Length);
        chars = new Char[charCount];
        int charsDecodedCount = utf8Decoder.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();
    }
}
using namespace System;
using namespace System::Text;
using namespace System::Collections;
int main()
{
   array<Char>^chars;
   array<Byte>^bytes = {99,204,128,234,130,160};
   Decoder^ utf8Decoder = Encoding::UTF8->GetDecoder();
   int charCount = utf8Decoder->GetCharCount( bytes, 0, bytes->Length
 );
   chars = gcnew array<Char>(charCount);
   int charsDecodedCount = utf8Decoder->GetChars( bytes, 0,
 bytes->Length, chars, 0 );
   Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount
 );
   Console::Write( "Decoded chars: " );
   IEnumerator^ myEnum = chars->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Char c = safe_cast<Char>(myEnum->Current);
      Console::Write( "[{0}]", c.ToString() );
   }

   Console::WriteLine();
}

import System .* ;
import System.Text .* ;

class UTF8EncodingExample
{
    public static void main(String[]
 args)
    {
        char chars[];
        ubyte bytes[] = new ubyte[] { 99, 204, 128, 234, 130,
 160 };
        Decoder utf8Decoder = Encoding.get_UTF8().GetDecoder();
        int charCount = utf8Decoder.GetCharCount(bytes, 0, bytes.length);
        chars = new char[charCount];
        int charsDecodedCount = utf8Decoder.GetChars(bytes,
            0, bytes.length, chars, 0);

        Console.WriteLine("{0} characters used to decode bytes.",
            String.valueOf(charsDecodedCount));
        Console.Write("Decoded chars: ");
        for (int iCtr = 0; iCtr < chars.length;
 iCtr++) {
            char c = chars[iCtr];
            Console.Write("[{0}]", String.valueOf(c));
        }
        Console.WriteLine();
    } //main
} //UTF8EncodingExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
UTF8Encoding クラス
UTF8Encoding メンバ
System.Text 名前空間
Decoder クラス
GetChars
GetString
GetCharCount
GetEncoder



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

UTF8Encoding.GetDecoder メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



UTF8Encoding.GetDecoder メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS