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

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

返品

書き込まれたバイト数。

実装

例外

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

データ サイズが無効です。

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

-または-

inputCount パラメーターに無効な値が含まれています。

inputBuffer パラメーターはnull

inputCount パラメーターには、負以外の数値と、inputBufferの長さ以下が必要です。

次のコード例では、TransformBlock メソッドを呼び出して、blockSizeによるinputBytes変換を反復処理する方法を示します。 このコード例は、 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);
}
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 バイトの出力境界に維持する必要があります。

適用対象

こちらもご覧ください