OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_CPP_FILE_IO_H_ | 5 #ifndef PPAPI_CPP_FILE_IO_H_ |
6 #define PPAPI_CPP_FILE_IO_H_ | 6 #define PPAPI_CPP_FILE_IO_H_ |
7 | 7 |
8 #include "ppapi/c/pp_time.h" | 8 #include "ppapi/c/pp_time.h" |
9 #include "ppapi/cpp/resource.h" | 9 #include "ppapi/cpp/resource.h" |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 /// large enough to hold the specified number of bytes to read. This | 86 /// large enough to hold the specified number of bytes to read. This |
87 /// function might perform a partial read. | 87 /// function might perform a partial read. |
88 /// | 88 /// |
89 /// @param[in] offset The offset into the file. | 89 /// @param[in] offset The offset into the file. |
90 /// @param[in] buffer The buffer to hold the specified number of bytes read. | 90 /// @param[in] buffer The buffer to hold the specified number of bytes read. |
91 /// @param[in] bytes_to_read The number of bytes to read from | 91 /// @param[in] bytes_to_read The number of bytes to read from |
92 /// <code>offset</code>. | 92 /// <code>offset</code>. |
93 /// @param[in] cc A <code>CompletionCallback</code> to be called upon | 93 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
94 /// completion of Read(). | 94 /// completion of Read(). |
95 /// | 95 /// |
96 /// @return An The number of bytes read an error code from | 96 /// @return The number of bytes read an error code from |
97 /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 97 /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
98 /// reached. It is valid to call Read() multiple times with a completion | 98 /// reached. It is valid to call Read() multiple times with a completion |
99 /// callback to queue up parallel reads from the file at different offsets. | 99 /// callback to queue up parallel reads from the file at different offsets. |
100 int32_t Read(int64_t offset, | 100 int32_t Read(int64_t offset, |
101 char* buffer, | 101 char* buffer, |
102 int32_t bytes_to_read, | 102 int32_t bytes_to_read, |
103 const CompletionCallback& cc); | 103 const CompletionCallback& cc); |
104 | 104 |
105 /// Write() writes to an offset in the file. This function might perform a | 105 /// Write() writes to an offset in the file. This function might perform a |
106 /// partial write. The FileIO object must have been opened with write access. | 106 /// partial write. The FileIO object must have been opened with write access. |
107 /// | 107 /// |
108 /// @param[in] offset The offset into the file. | 108 /// @param[in] offset The offset into the file. |
109 /// @param[in] buffer The buffer to hold the specified number of bytes read. | 109 /// @param[in] buffer The buffer to hold the specified number of bytes read. |
110 /// @param[in] bytes_to_write The number of bytes to write to | 110 /// @param[in] bytes_to_write The number of bytes to write to |
111 /// <code>offset</code>. | 111 /// <code>offset</code>. |
112 /// @param[in] cc A <code>CompletionCallback</code> to be called upon | 112 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
113 /// completion of Write(). | 113 /// completion of Write(). |
114 /// | 114 /// |
115 /// @return An The number of bytes written or an error code from | 115 /// @return The number of bytes written or an error code from |
116 /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 116 /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
117 /// reached. It is valid to call Write() multiple times with a completion | 117 /// reached. It is valid to call Write() multiple times with a completion |
118 /// callback to queue up parallel writes to the file at different offsets. | 118 /// callback to queue up parallel writes to the file at different offsets. |
119 int32_t Write(int64_t offset, | 119 int32_t Write(int64_t offset, |
120 const char* buffer, | 120 const char* buffer, |
121 int32_t bytes_to_write, | 121 int32_t bytes_to_write, |
122 const CompletionCallback& cc); | 122 const CompletionCallback& cc); |
123 | 123 |
124 /// SetLength() sets the length of the file. If the file size is extended, | 124 /// SetLength() sets the length of the file. If the file size is extended, |
125 /// then the extended area of the file is zero-filled. The FileIO object must | 125 /// then the extended area of the file is zero-filled. The FileIO object must |
(...skipping 24 matching lines...) Expand all Loading... |
150 /// | 150 /// |
151 /// <strong>Note:</strong> If the FileIO object is destroyed, and it is still | 151 /// <strong>Note:</strong> If the FileIO object is destroyed, and it is still |
152 /// open, then it will be implicitly closed, so you are not required to call | 152 /// open, then it will be implicitly closed, so you are not required to call |
153 /// Close(). | 153 /// Close(). |
154 void Close(); | 154 void Close(); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace pp | 157 } // namespace pp |
158 | 158 |
159 #endif // PPAPI_CPP_FILE_IO_H_ | 159 #endif // PPAPI_CPP_FILE_IO_H_ |
OLD | NEW |