<p dir="auto">The documentation for <code class="notranslate">read()</code> in the <code class="notranslate">Reader</code> trait specifies:</p>
<blockquote>
<p dir="auto">Read bytes, up to the length of <code class="notranslate">buf</code> and place them in <code class="notranslate">buf</code>.<br>
Returns the number of bytes read. The number of bytes read may<br>
be less than the number requested, even 0. Returns <code class="notranslate">Err</code> on EOF.</p>
</blockquote>
<p dir="auto">However, the <code class="notranslate">BufferedReader</code> type which implements <code class="notranslate">Reader</code> will only perform a single read up to its internal buffer size of 64kB, regardless of the input stream size or output buffer size.</p>
<p dir="auto">The following test program creates a 200kB file and reads it into a similarly sized buffer. Only the first 64kB is read:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="use std::io::{BufferedReader, BufferedWriter, File};

fn main() {

    let buf_size = 200*1024;
    let filename = &quot;/tmp/test.dat&quot;;

    println!(&quot;Generating buffer of {} bytes&quot;, buf_size);
    let source_data = Vec::from_elem(buf_size, 0xA5);

    let path = Path::new(filename);
    let mut file = BufferedWriter::new(File::create(&amp;path));
    match file.write(source_data.as_slice()) {
        Ok(()) =&gt; (), // succeeded
        Err(e) =&gt; println!(&quot;failed in write: {}&quot;, e),
    }

    let path = Path::new(filename);
    let mut file = BufferedReader::new(File::open(&amp;path));
    let mut read_data = Vec::from_elem(buf_size, 0);
    println!(&quot;Buffer capacity {} bytes&quot;, read_data.len());

    match file.read(read_data.as_mut_slice()) {
        Ok(bytes_read) =&gt; println!(&quot;Read {} bytes&quot;, bytes_read),
        Err(e) =&gt; println!(&quot;error reading: {}&quot;, e)
    }
}"><pre class="notranslate"><code class="notranslate">use std::io::{BufferedReader, BufferedWriter, File};

fn main() {

    let buf_size = 200*1024;
    let filename = "/tmp/test.dat";

    println!("Generating buffer of {} bytes", buf_size);
    let source_data = Vec::from_elem(buf_size, 0xA5);

    let path = Path::new(filename);
    let mut file = BufferedWriter::new(File::create(&amp;path));
    match file.write(source_data.as_slice()) {
        Ok(()) =&gt; (), // succeeded
        Err(e) =&gt; println!("failed in write: {}", e),
    }

    let path = Path::new(filename);
    let mut file = BufferedReader::new(File::open(&amp;path));
    let mut read_data = Vec::from_elem(buf_size, 0);
    println!("Buffer capacity {} bytes", read_data.len());

    match file.read(read_data.as_mut_slice()) {
        Ok(bytes_read) =&gt; println!("Read {} bytes", bytes_read),
        Err(e) =&gt; println!("error reading: {}", e)
    }
}
</code></pre></div>
<p dir="auto">The output is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Generating buffer of 204800 bytes
Buffer capacity 204800 bytes
Read 65536 bytes"><pre class="notranslate"><code class="notranslate">Generating buffer of 204800 bytes
Buffer capacity 204800 bytes
Read 65536 bytes
</code></pre></div>
<p dir="auto">The expected output would obviously report "Read 204800 bytes".  As per the trait's documentation, the <code class="notranslate">read()</code> method should read up to the size of either the input stream or the output buffer, whichever is smaller; reading in chunks of 64kB in its internal buffer is an implementation detail.</p>
<p dir="auto">If instead of using <code class="notranslate">read()</code> the <code class="notranslate">read_at_least()</code> method is called (with <code class="notranslate">buf_size</code>), the full size is read.</p>