mirror of
https://github.com/yasuhirokimura/db18
synced 2026-06-08 18:29:23 +00:00
245 lines
8.8 KiB
HTML
245 lines
8.8 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<title>DbStream::read()</title>
|
||
<link rel="stylesheet" href="apiReference.css" type="text/css" />
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
||
<link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
|
||
<link rel="up" href="blob.html" title="Chapter 14. External Files" />
|
||
<link rel="prev" href="dbstream_close.html" title="DbStream::close()" />
|
||
<link rel="next" href="dbstream_size.html" title="DbStream::size()" />
|
||
</head>
|
||
<body>
|
||
<div xmlns="" class="navheader">
|
||
<div class="libver">
|
||
<p>Library Version 18.1.40</p>
|
||
</div>
|
||
<table width="100%" summary="Navigation header">
|
||
<tr>
|
||
<th colspan="3" align="center">
|
||
|
||
<span xmlns="http://www.w3.org/1999/xhtml">DbStream::read()</span>
|
||
</th>
|
||
</tr>
|
||
<tr>
|
||
<td width="20%" align="left"><a accesskey="p" href="dbstream_close.html">Prev</a> </td>
|
||
<th width="60%" align="center">Chapter 14.
|
||
External Files
|
||
</th>
|
||
<td width="20%" align="right"> <a accesskey="n" href="dbstream_size.html">Next</a></td>
|
||
</tr>
|
||
</table>
|
||
<hr />
|
||
</div>
|
||
<div class="sect1" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title" style="clear: both"><a id="dbstream_read"></a>
|
||
|
||
<span>DbStream::read()</span>
|
||
</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<pre class="programlisting">#include <db_cxx.h>
|
||
|
||
int
|
||
DbStream::read(Dbt *data, db_off_t offset, u_int32_t size,
|
||
u_int32_t flags); </pre>
|
||
<p>
|
||
The <code class="methodname">DbStream::read()</code> method reads
|
||
<span class="bold"><strong>size</strong></span> bytes from the external file,
|
||
starting at <span class="bold"><strong>offset</strong></span>, into the
|
||
DBT <span class="bold"><strong>data</strong></span>.
|
||
</p>
|
||
<p>
|
||
The stream is created using <a class="xref" href="dbstream.html" title="Dbc::db_stream()">
|
||
|
||
<span>Dbc::db_stream()</span>
|
||
</a>.
|
||
</p>
|
||
<p>
|
||
Unless otherwise specified, the
|
||
<code class="methodname">DbStream::read()</code> <span>
|
||
|
||
<span>
|
||
method either returns a non-zero error value or throws an
|
||
exception that encapsulates a non-zero error value on
|
||
failure, and returns 0 on success.
|
||
</span>
|
||
</span>
|
||
</p>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139755608687536"></a>Parameters</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139755608688784"></a>data</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>data</strong></span> parameter is
|
||
the <a class="link" href="dbt.html" title="Chapter 4. The Dbt Handle">Dbt</a> into which you
|
||
want to place the data read using this method.
|
||
</p>
|
||
<p>
|
||
Note that the data DBT must be set with one of the
|
||
following flags, or this method will return an error:
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_MALLOC">DB_DBT_MALLOC</a>,
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_REALLOC">DB_DBT_REALLOC</a>,
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_USERMEM">DB_DBT_USERMEM</a>, or
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_APPMALLOC">DB_DBT_APPMALLOC</a>.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139755608693968"></a>offset</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>offset</strong></span> parameter
|
||
indicates the starting position, in bytes, from the
|
||
beginning of the external file where you want the read to
|
||
begin.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139755608754368"></a>size</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>size</strong></span> parameter
|
||
indicates the number of bytes to read.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139755608715232"></a>flags</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>flags</strong></span> parameter must be set to 0.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139755608731888"></a>Errors</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <code class="methodname">DbStream::read()</code> <span>
|
||
|
||
<span>
|
||
method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
|
||
exception, encapsulating one of the following non-zero errors, or return one
|
||
of the following non-zero errors:
|
||
</span>
|
||
</span>
|
||
</p>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139755608666896"></a>DB_BUFFER_SMALL</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The Dbt provided to this method was not configured
|
||
appropriately, and so there is not enough space allocated
|
||
for the bytes you are trying to read.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139755608682144"></a>EINVAL</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
An invalid flag value or parameter was specified; or if the
|
||
Dbt was configured with
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_PARTIAL">DB_DBT_PARTIAL</a>.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139755608665264"></a>Class</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="link" href="blob.html" title="Chapter 14. External Files">DbStream</a>
|
||
</p>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139755608684208"></a>See Also</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="xref" href="blob.html#bloblist" title="External Files and Related Methods">External Files and Related Methods</a>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="navfooter">
|
||
<hr />
|
||
<table width="100%" summary="Navigation footer">
|
||
<tr>
|
||
<td width="40%" align="left"><a accesskey="p" href="dbstream_close.html">Prev</a> </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="u" href="blob.html">Up</a>
|
||
</td>
|
||
<td width="40%" align="right"> <a accesskey="n" href="dbstream_size.html">Next</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%" align="left" valign="top">
|
||
|
||
<span>DbStream::close()</span>
|
||
</td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="h" href="index.html">Home</a>
|
||
</td>
|
||
<td width="40%" align="right" valign="top">
|
||
|
||
<span>DbStream::size()</span>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</body>
|
||
</html>
|