翻訳への提案を行います
 
他のユーザーによる提案:

progress indicator
他の提案はありません。
クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
.NET Framework 4
System.Text 名前空間
System.Text
Encoding クラス
Encoding メソッド
GetString メソッド
 GetString メソッド (Byte[], Int32, Int3...
すべて縮小/すべて展開 すべて縮小
コンテンツの表示:   英語と日本語を並べて表示コンテンツの表示: 英語と日本語を並べて表示
.NET Framework Class Library
Encoding..::.GetString Method (array<Byte>[]()[], Int32, Int32)

When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a string.

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)
Visual Basic
Public Overridable Function GetString ( _
    bytes As Byte(), _
    index As Integer, _
    count As Integer _
) As String
C#
public virtual string GetString(
    byte[] bytes,
    int index,
    int count
)
Visual C++
public:
virtual String^ GetString(
    array<unsigned char>^ bytes, 
    int index, 
    int count
)
F#
abstract GetString : 
        bytes:byte[] * 
        index:int * 
        count:int -> string 
override GetString : 
        bytes:byte[] * 
        index:int * 
        count:int -> string 

Parameters

bytes
Type: array<System..::.Byte>[]()[]
The byte array containing the sequence of bytes to decode.
index
Type: System..::.Int32
The index of the first byte to decode.
count
Type: System..::.Int32
The number of bytes to decode.

Return Value

Type: System..::.String
A String containing the results of decoding the specified sequence of bytes.
ExceptionCondition
ArgumentException

The byte array contains invalid Unicode code points.

ArgumentNullException

bytes is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

index or count is less than zero.

-or-

index and count do not denote a valid range in bytes.

DecoderFallbackException

A fallback occurred (see Character Encoding in the .NET Framework for complete explanation)

-and-

DecoderFallback is set to DecoderExceptionFallback.

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

See the Remarks under Encoding..::.GetChars for more discussion of decoding techniques and considerations.

The following example demonstrates how to read a UTF-8 encoded string from a binary file.

Visual Basic
      Private Function ReadAuthor(binary_file As Stream) As String
         Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8
         ' Read string from binary file with UTF8 encoding
         Dim buffer(30) As Byte
         binary_file.Read(buffer, 0, 30)
         Return encoding.GetString(buffer)
      End Function

' This code produces the following output.
'
'Marin Millar                  
'BodyName:        iso-8859-1
'HeaderName:      Windows-1252
'WebName:         Windows-1252
'CodePage:        1252
'EncodingName:    Western European (Windows)
'WindowsCodePage: 1252
'MailNewsDisplay: True
'MailNewsSave:    True
'BrowserDisplay:  True
'BrowserSave:     True
'
C#
    private string ReadAuthor(Stream binary_file) {
      System.Text.Encoding encoding = System.Text.Encoding.UTF8;
      // Read string from binary file with UTF8 encoding
      byte[] buffer = new byte[30];
      binary_file.Read(buffer, 0, 30);
      return encoding.GetString(buffer);
    }
/* This code produces the following output.

Marin Millar                  
BodyName:        iso-8859-1
HeaderName:      Windows-1252
WebName:         Windows-1252
CodePage:        1252
EncodingName:    Western European (Windows)
WindowsCodePage: 1252
MailNewsDisplay: True
MailNewsSave:    True
BrowserDisplay:  True
BrowserSave:     True
*/
Visual C++
   private:
      String^ ReadAuthor( Stream^ binary_file )
      {
         System::Text::Encoding^ encoding = System::Text::Encoding::UTF8;
         // Read string from binary file with UTF8 encoding
         array<Byte>^ buffer = gcnew array<Byte>(30);
         binary_file->Read( buffer, 0, 30 );
         return encoding->GetString( buffer );
      }
/* This code produces the following output.

Marin Millar                  
BodyName:        iso-8859-1
HeaderName:      Windows-1252
WebName:         Windows-1252
CodePage:        1252
EncodingName:    Western European (Windows)
WindowsCodePage: 1252
MailNewsDisplay: True
MailNewsSave:    True
BrowserDisplay:  True
BrowserSave:     True

*/

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework クラス ライブラリ
Encoding..::.GetString メソッド (array<Byte>[]()[], Int32, Int32)

派生クラスでオーバーライドされた場合、指定したバイト配列に格納されているバイト シーケンスを文字列にデコードします。

名前空間:  System.Text
アセンブリ:  mscorlib (mscorlib.dll 内)
Visual Basic
Public Overridable Function GetString ( _
    bytes As Byte(), _
    index As Integer, _
    count As Integer _
) As String
C#
public virtual string GetString(
    byte[] bytes,
    int index,
    int count
)
Visual C++
public:
virtual String^ GetString(
    array<unsigned char>^ bytes, 
    int index, 
    int count
)
F#
abstract GetString : 
        bytes:byte[] * 
        index:int * 
        count:int -> string 
override GetString : 
        bytes:byte[] * 
        index:int * 
        count:int -> string 

パラメーター

bytes
型: array<System..::.Byte>[]()[]
デコード対象のバイト シーケンスが格納されたバイト配列。
index
型: System..::.Int32
デコードする最初のバイトのインデックス。
count
型: System..::.Int32
デコードするバイト数。

戻り値

型: System..::.String
指定したバイト シーケンスのデコード結果が格納されている String
例外条件
ArgumentException

このバイト配列には、無効な Unicode コード ポイントが含まれています。

ArgumentNullException

bytesnullNothingnullptrnull 参照 (Visual Basic では Nothing) なので、

ArgumentOutOfRangeException

index または count が 0 未満です。

または

index および countbytes 内の有効な範囲を示していません。

DecoderFallbackException

フォールバックが発生しました (詳細については、「.NET Framework における文字エンコーディング」を参照してください)。

および

DecoderFallbackDecoderExceptionFallback に設定されます。

変換するデータが一連のブロックの形でのみ得られる場合 (ストリームから読み込むデータなど)、または、データ容量が大きいために小さなブロックに分割する必要がある場合は、派生クラスの GetDecoder メソッドで得られる Decoder、または GetEncoder メソッドで得られる Encoder をアプリケーションで使用する必要があります。

デコード手法および考慮事項の詳細については、Encoding..::.GetChars の「解説」を参照してください。

次の例は、バイナリ ファイルから UTF-8 でエンコードされた文字列を読み取る方法を示しています。

Visual Basic
      Private Function ReadAuthor(binary_file As Stream) As String
         Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8
         ' Read string from binary file with UTF8 encoding
         Dim buffer(30) As Byte
         binary_file.Read(buffer, 0, 30)
         Return encoding.GetString(buffer)
      End Function

' This code produces the following output.
'
'Marin Millar                  
'BodyName:        iso-8859-1
'HeaderName:      Windows-1252
'WebName:         Windows-1252
'CodePage:        1252
'EncodingName:    Western European (Windows)
'WindowsCodePage: 1252
'MailNewsDisplay: True
'MailNewsSave:    True
'BrowserDisplay:  True
'BrowserSave:     True
'
C#
    private string ReadAuthor(Stream binary_file) {
      System.Text.Encoding encoding = System.Text.Encoding.UTF8;
      // Read string from binary file with UTF8 encoding
      byte[] buffer = new byte[30];
      binary_file.Read(buffer, 0, 30);
      return encoding.GetString(buffer);
    }
/* This code produces the following output.

Marin Millar                  
BodyName:        iso-8859-1
HeaderName:      Windows-1252
WebName:         Windows-1252
CodePage:        1252
EncodingName:    Western European (Windows)
WindowsCodePage: 1252
MailNewsDisplay: True
MailNewsSave:    True
BrowserDisplay:  True
BrowserSave:     True
*/
Visual C++
   private:
      String^ ReadAuthor( Stream^ binary_file )
      {
         System::Text::Encoding^ encoding = System::Text::Encoding::UTF8;
         // Read string from binary file with UTF8 encoding
         array<Byte>^ buffer = gcnew array<Byte>(30);
         binary_file->Read( buffer, 0, 30 );
         return encoding->GetString( buffer );
      }
/* This code produces the following output.

Marin Millar                  
BodyName:        iso-8859-1
HeaderName:      Windows-1252
WebName:         Windows-1252
CodePage:        1252
EncodingName:    Western European (Windows)
WindowsCodePage: 1252
MailNewsDisplay: True
MailNewsSave:    True
BrowserDisplay:  True
BrowserSave:     True

*/

.NET Framework

サポート対象: 4、3.5、3.0、2.0、1.1、1.0

.NET Framework Client Profile

サポート対象: 4、3.5 SP1

サポート対象:

Windows 7, Windows Vista SP1 以降, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core はサポート対象外), Windows Server 2008 R2 (SP1 以降で Server Core をサポート), Windows Server 2003 SP2

.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2012 Microsoft. All rights reserved. 使用条件 | 商標 | プライバシー
Page view tracker