日本語PDF

Append(byte[ ], int, int)

このインスタンス・メソッドでは、指定されたバイト配列バッファのデータを現行のOracleBlobインスタンスの最後に追加します。

宣言

// C#
public void Append(byte[] buffer, int offset, int count);

パラメータ

  • buffer

    バイトの配列

  • offset

    データ読取り元バッファのゼロ・ベースのバイト・オフセット

  • count

    追加するバイト数

例外

ObjectDisposedException - オブジェクトはすでに処理されています。

InvalidOperationException - OracleConnectionがオープンされていないか、またはオブジェクトの存続中にクローズされています。

// C#
 
using System;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
 
class AppendSample
{
  static void Main()
  {
    string constr = "User Id=scott;Password=tiger;Data Source=oracle";
    OracleConnection con = new OracleConnection(constr);
    con.Open();
 
    OracleBlob blob = new OracleBlob(con);
      
    // Append 2 bytes {4, 5} to the OracleBlob
    byte[] buffer = new byte[3] {4, 5, 6};
    blob.Append(buffer, 0, 2);
 
    byte[] appendBuffer = blob.Value;
 
    // Prints "appendBuffer = 45"
    Console.Write("appendBuffer = ");
    for(int index = 0; index < appendBuffer.Length; index++)
    {
      Console.Write(appendBuffer[index]);
    }
    Console.WriteLine();
 
    blob.Close();
    blob.Dispose();
 
    con.Close();
    con.Dispose();
  }
}