diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 23:08:47 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 23:08:47 +0000 |
commit | b2ca508afc56d4b7f6d5b036dd721604440210b3 (patch) | |
tree | 69b9b1146c0af1e063b5f38ce3e2307b7a223399 /net/base/file_stream.h | |
parent | 2ce5d948eb4ac06b30fc411d276eb6fd70ad1721 (diff) | |
download | chromium_src-b2ca508afc56d4b7f6d5b036dd721604440210b3.zip chromium_src-b2ca508afc56d4b7f6d5b036dd721604440210b3.tar.gz chromium_src-b2ca508afc56d4b7f6d5b036dd721604440210b3.tar.bz2 |
Add a new method ReadUntilComplete to FileStream which ensures that all requested bytes are read from the file in one call, assuming no errors occurr or EOF is reached.
Review URL: http://codereview.chromium.org/21363
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/file_stream.h')
-rw-r--r-- | net/base/file_stream.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/base/file_stream.h b/net/base/file_stream.h index 20466b4..eaf6a0d 100644 --- a/net/base/file_stream.h +++ b/net/base/file_stream.h @@ -81,6 +81,13 @@ class FileStream { // You can pass NULL as the callback for synchronous I/O. int Read(char* buf, int buf_len, CompletionCallback* callback); + // Performs the same as Read, but ensures that exactly buf_len bytes + // are copied into buf. A partial read may occur, but only as a result of + // end-of-file or fatal error. Returns the number of bytes copied into buf, + // 0 if at end-of-file and no bytes have been read into buf yet, + // or an error code if the operation could not be performed. + int ReadUntilComplete(char *buf, int buf_len); + // Call this method to write data at the current stream position. Up to // buf_len bytes will be written from buf. (In other words, partial writes are // allowed.) Returns the number of bytes written, or an error code if the |