Reading from an InputStream and writing to an OutputStream
<p>This should be very simple, and I've searched Google, but didn't see anyone mentioning the issue I've noticed.  Everything that I've seen does the same basic thing. Like this:</p>

<pre><code>byte [] buffer = new byte[256];
int bytesRead = 0;
while((bytesRead = input.read(buffer)) != -1)
{
    output.write(buffer, 0, bytesRead);
}
</code></pre>

<p>I know read() returns -1 when EOF is reached, but what if the file is smaller than the buffer or even the same size?  Fox example, a 200 byte file is being read in. I assume it read the 200 bytes, but returns -1. That matches the javadocs, but it also means the write() is never called. I would have expected to actually tell me it read the 200 bytes, and on the next iteration to return -1.</p>

<p>How can I get around this "issue"?  </p>
