IDataRecord.GetBytes(Int32, Int64, Byte[], Int32, Int32) IDataRecord.GetBytes(Int32, Int64, Byte[], Int32, Int32) IDataRecord.GetBytes(Int32, Int64, Byte[], Int32, Int32) IDataRecord.GetBytes(Int32, Int64, Byte[], Int32, Int32) Method

定义

将字节流从指定列偏移量读入到缓冲区中,将其作为从给定缓冲区偏移量开始的数组。Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.

public:
 long GetBytes(int i, long fieldOffset, cli::array <System::Byte> ^ buffer, int bufferoffset, int length);
public long GetBytes (int i, long fieldOffset, byte[] buffer, int bufferoffset, int length);
abstract member GetBytes : int * int64 * byte[] * int * int -> int64
Public Function GetBytes (i As Integer, fieldOffset As Long, buffer As Byte(), bufferoffset As Integer, length As Integer) As Long

参数

i
Int32 Int32 Int32 Int32

从零开始的列序号。The zero-based column ordinal.

fieldOffset
Int64 Int64 Int64 Int64

字段中作为读取操作起始位置的索引。The index within the field from which to start the read operation.

buffer
Byte[]

要读入字节流的缓冲区。The buffer into which to read the stream of bytes.

bufferoffset
Int32 Int32 Int32 Int32

开始读取操作的 buffer 的索引。The index for buffer to start the read operation.

length
Int32 Int32 Int32 Int32

要读取的字节数。The number of bytes to read.

返回

读取的实际字节数。The actual number of bytes read.

异常

传递的索引位于 0 至 FieldCount 的范围之外。The index passed was outside the range of 0 through FieldCount.

注解

GetBytes返回字段中的可用字节数。GetBytes returns the number of available bytes in the field. 通常, 这是字段的准确长度。Frequently this is the exact length of the field. 但是, 如果GetBytes已使用从字段获取字节, 则返回的数字可能小于字段的实际长度。However, the number returned may be less than the true length of the field if GetBytes has already been used to obtain bytes from the field.

如果传递的缓冲区为null, 则返回行的长度 ( GetBytes以字节为单位)。If you pass a buffer that is null, GetBytes returns the length of the row in bytes.

不执行任何转换;因此, 检索的数据必须已经是字节数组。No conversions are performed; therefore the data retrieved must already be a byte array.

适用于