ToBase64Transform.TransformBlock(Byte[], Int32, Int32, Byte[], Int32) メソッド

定義

入力バイト配列の指定した領域を base 64 に変換し、その結果を出力バイト配列の指定した領域にコピーします。

public:
 virtual int TransformBlock(cli::array <System::Byte> ^ inputBuffer, int inputOffset, int inputCount, cli::array <System::Byte> ^ outputBuffer, int outputOffset);
public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset);
abstract member TransformBlock : byte[] * int * int * byte[] * int -> int
override this.TransformBlock : byte[] * int * int * byte[] * int -> int
Public Function TransformBlock (inputBuffer As Byte(), inputOffset As Integer, inputCount As Integer, outputBuffer As Byte(), outputOffset As Integer) As Integer

パラメーター

inputBuffer
Byte[]

base 64 に変換する入力。

inputOffset
Int32

入力バイト配列内のデータの使用開始位置を示すオフセット。

inputCount
Int32

データとして使用する入力バイト配列内のバイト数。

outputBuffer
Byte[]

結果を書き込む先の出力。

outputOffset
Int32

データの書き込みの開始位置を示す出力バイト配列内のオフセット。

戻り値

Int32

書き込むバイト数。

実装

例外

現在の ToBase64Transform オブジェクトは既に破棄されています。

データ サイズが有効ではありません。

inputBuffer パラメーターに無効なオフセット長が含まれています。

  • または - inputCount パラメーターに正しくない値が含まれています。

inputBuffer パラメーターが null です。

inputBuffer パラメーターには、負でない数が必要です。

次のコード例では、メソッドを呼び出して変換を TransformBlock 反復処理 inputBytes する方法を blockSize示します。 このコード例は、ToBase64Transform クラスのために提供されている大規模な例の一部です。

int inputBlockSize = base64Transform->InputBlockSize;
while ( inputBytes->Length - inputOffset > inputBlockSize )
{
   base64Transform->TransformBlock(
      inputBytes,
      inputOffset,
      inputBytes->Length - inputOffset,
      outputBytes,
      0 );

   inputOffset += base64Transform->InputBlockSize;
   outputFileStream->Write(
      outputBytes,
      0,
      base64Transform->OutputBlockSize );
}
int inputBlockSize = base64Transform.InputBlockSize;

while(inputBytes.Length - inputOffset > inputBlockSize)
{
    base64Transform.TransformBlock(
        inputBytes,
        inputOffset,
        inputBytes.Length - inputOffset,
        outputBytes,
        0);

    inputOffset += base64Transform.InputBlockSize;
    outputFileStream.Write(
        outputBytes, 
        0, 
        base64Transform.OutputBlockSize);
}
Dim inputBlockSize As Integer = base64Transform.InputBlockSize

While (inputBytes.Length - inputOffset > inputBlockSize)
    base64Transform.TransformBlock( _
        inputBytes, _
        inputOffset, _
        inputBytes.Length - inputOffset, _
        outputBytes, _
        0)

    inputOffset += base64Transform.InputBlockSize
    outputFileStream.Write(outputBytes, _
        0, _
        base64Transform.OutputBlockSize)
End While

注釈

この ToBase64Transform クラスは、3 バイトの入力ブロックを処理し、4 バイトの出力ブロックを作成するブロック アルゴリズムです。 このメソッドは TransformBlock 、24 ビットの入力ブロックを 32 ビットの文字データに変換します。 ブロック変換に一致させるには、3 バイトの入力境界を 4 バイトの出力境界に維持する必要があります。

適用対象

こちらもご覧ください