Write
Stream
をオーバーライドします
このインスタンス・メソッドでは、指定されたバッファをOracleBlob
に書き込みます。
宣言
// C# public override void Write(byte[ ] buffer, int offset, int count);
パラメータ
-
buffer
データを指定するバイト配列
buffer
-
offset
buffer
の読取りが開始される0
ベース・オフセット(バイト) -
count
OracleBlob
に書き込まれるデータ量(バイト)
例外
ObjectDisposedException
- オブジェクトはすでに処理されています。
InvalidOperationException
- OracleConnection
がオープンされていないか、またはオブジェクトの存続中にクローズされています。
ArgumentOutOfRangeException
- この例外は次のいずれかの条件が存在する場合に表示されます。
-
offset
またはcount
が0
未満の場合 -
offset
がbuffer
.Length
以上である場合 -
offset
およびcount
の合計がbuffer
.Length
より大きい場合
備考
OracleBlob
のoffset
先はPosition
プロパティで指定できます。
例
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class WriteSample { 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); // Set the Position for the Write blob.Position = 0; // Begin ChunkWrite to improve performance // Index updates occur only once after EndChunkWrite blob.BeginChunkWrite(); // Write to the OracleBlob in 5 chunks of 2 bytes each byte[] b = new byte[2] {1, 2}; for(int index = 0; index < 5; index++) { blob.Write(b, 0, b.Length); } blob.EndChunkWrite(); byte[] chunkBuffer = blob.Value; // Prints "chunkBuffer = 1212121212" Console.Write("chunkBuffer = "); for(int index = 0; index < chunkBuffer.Length; index++) { Console.Write(chunkBuffer[index]); } Console.WriteLine(); blob.Close(); blob.Dispose(); con.Close(); con.Dispose(); } }