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 매개 변수에 0 또는 양의 정수가 필요한 경우

예제

다음 코드 예제에서는 메서드를 호출 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바이트 출력 경계로 유지해야 합니다.

적용 대상

추가 정보