本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.GetBytes方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.GetBytes方法的具体用法?C# SqliteDataReader.GetBytes怎么用?C# SqliteDataReader.GetBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Data.Sqlite.SqliteDataReader
的用法示例。
在下文中一共展示了SqliteDataReader.GetBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getBytes
//Metodo para conversion de imagenes de tipo BLOB a array de bytes
public static byte[] getBytes(int columna,SqliteDataReader reader)
{
const int CHUNK_SIZE = 2 * 1024;
byte[] buffer = new byte[CHUNK_SIZE];
long bytesRead;
long fieldOffset = 0;
int bufferoffset = 0;
using (MemoryStream stream = new MemoryStream())
{
while ((bytesRead = reader.GetBytes(columna, fieldOffset, buffer, bufferoffset, buffer.Length)) > 0)
{
stream.Write(buffer, 0, (int)bytesRead);
fieldOffset += bytesRead;
}
return stream.ToArray();
}
}
示例2: GetBytes
private static byte[] GetBytes(SQLiteDataReader reader)
{
const int CHUNK_SIZE = 2 * 1024;
byte[] buffer = new byte[CHUNK_SIZE];
long bytesRead;
long fieldOffset = 0;
using (MemoryStream stream = new MemoryStream())
{
while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0)
{
byte[] actualRead = new byte[bytesRead];
Buffer.BlockCopy(buffer, 0, actualRead, 0, (int)bytesRead);
stream.Write(actualRead, 0, actualRead.Length);
fieldOffset += bytesRead;
}
return stream.ToArray();
}
}
示例3: ReadBinaryBlob
static int ReadBinaryBlob(SqliteDataReader reader, int column, ref byte[] buffer)
{
long nread;
// first, get the length of the buffer needed
if ((nread = reader.GetBytes (column, 0, null, 0, buffer.Length)) > buffer.Length)
Array.Resize (ref buffer, (int) nread);
// read the certificate data
return (int) reader.GetBytes (column, 0, buffer, 0, (int) nread);
}