Pepper_31_C_interfaces
|
#include <ppb_file_io.h>
Public Attributes | |
PP_Resource(* | Create )(PP_Instance instance) |
PP_Bool(* | IsFileIO )(PP_Resource resource) |
int32_t(* | Open )(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) |
int32_t(* | Query )(PP_Resource file_io, struct PP_FileInfo *info, struct PP_CompletionCallback callback) |
int32_t(* | Touch )(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) |
int32_t(* | Read )(PP_Resource file_io, int64_t offset, char *buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) |
int32_t(* | Write )(PP_Resource file_io, int64_t offset, const char *buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) |
int32_t(* | SetLength )(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) |
int32_t(* | Flush )(PP_Resource file_io, struct PP_CompletionCallback callback) |
void(* | Close )(PP_Resource file_io) |
int32_t(* | ReadToArray )(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput *output, struct PP_CompletionCallback callback) |
The PPB_FileIO
struct is used to operate on a regular file (PP_FileType_Regular).
Definition at line 85 of file ppb_file_io.h.
void(* PPB_FileIO_1_1::Close)(PP_Resource file_io) |
Close() cancels any IO that may be pending, and closes the FileIO object. Any pending callbacks will still run, reporting PP_ERROR_ABORTED
if pending IO was interrupted. It is not valid to call Open() again after a call to this method. Note: If the FileIO object is destroyed, and it is still open, then it will be implicitly closed, so you are not required to call Close().
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
Definition at line 266 of file ppb_file_io.h.
PP_Resource(* PPB_FileIO_1_1::Create)(PP_Instance instance) |
Create() creates a new FileIO object.
[in] | instance | A PP_Instance identifying the instance with the file. |
PP_Resource
corresponding to a FileIO if successful or 0 if the module is invalid. Definition at line 95 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::Flush)(PP_Resource file_io, struct PP_CompletionCallback callback) |
Flush() flushes changes to disk. This call can be very expensive! The FileIO object must have been opened with write access and there must be no other operations pending.
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
[in] | callback | A PP_CompletionCallback to be called upon completion of Flush(). |
pp_errors.h
. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. Definition at line 253 of file ppb_file_io.h.
PP_Bool(* PPB_FileIO_1_1::IsFileIO)(PP_Resource resource) |
IsFileIO() determines if the provided resource is a FileIO.
[in] | resource | A PP_Resource corresponding to a FileIO. |
PP_TRUE
if the resource is a PPB_FileIO
, PP_FALSE
if the resource is invalid or some type other than PPB_FileIO
. Definition at line 105 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::Open)(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) |
Open() opens the specified regular file for I/O according to the given open flags, which is a bit-mask of the PP_FileOpenFlags
values. Upon success, the corresponding file is classified as "in use" by this FileIO object until such time as the FileIO object is closed or destroyed.
[in] | file_io | A PP_Resource corresponding to a FileIO. |
[in] | file_ref | A PP_Resource corresponding to a file reference. |
[in] | open_flags | A bit-mask of the PP_FileOpenFlags values. |
[in] | callback | A PP_CompletionCallback to be called upon completion of Open(). |
pp_errors.h
. Definition at line 124 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::Query)(PP_Resource file_io, struct PP_FileInfo *info, struct PP_CompletionCallback callback) |
Query() queries info about the file opened by this FileIO object. The FileIO object must be opened, and there must be no other operations pending.
[in] | file_io | A PP_Resource corresponding to a FileIO. |
[out] | info | The PP_FileInfo structure representing all information about the file. |
[in] | callback | A PP_CompletionCallback to be called upon completion of Query(). |
pp_errors.h
. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. Definition at line 144 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::Read)(PP_Resource file_io, int64_t offset, char *buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) |
Read() reads from an offset in the file. The size of the buffer must be large enough to hold the specified number of bytes to read. This function might perform a partial read, meaning all the requested bytes might not be returned, even if the end of the file has not been reached.
ReadToArray() is preferred to Read() when doing asynchronous operations.
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
[in] | offset | The offset into the file. |
[in] | buffer | The buffer to hold the specified number of bytes read. |
[in] | bytes_to_read | The number of bytes to read from offset . |
[in] | callback | A PP_CompletionCallback to be called upon completion of Read(). |
pp_errors.h
. If the return value is 0, then end-of-file was reached. It is valid to call Read() multiple times with a completion callback to queue up parallel reads from the file, but pending reads cannot be interleaved with other operations. Definition at line 191 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::ReadToArray)(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput *output, struct PP_CompletionCallback callback) |
ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be provided so that output will be stored in its allocated buffer. This function might perform a partial read.
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
[in] | offset | The offset into the file. |
[in] | max_read_length | The maximum number of bytes to read from offset . |
[in] | output | A PP_ArrayOutput to hold the output data. |
[in] | callback | A PP_CompletionCallback to be called upon completion of ReadToArray(). |
pp_errors.h
. If the return value is 0, then end-of-file was reached. It is valid to call ReadToArray() multiple times with a completion callback to queue up parallel reads from the file, but pending reads cannot be interleaved with other operations. Definition at line 287 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::SetLength)(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) |
SetLength() sets the length of the file. If the file size is extended, then the extended area of the file is zero-filled. The FileIO object must have been opened with write access and there must be no other operations pending.
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
[in] | length | The length of the file to be set. |
[in] | callback | A PP_CompletionCallback to be called upon completion of SetLength(). |
pp_errors.h
. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. Definition at line 236 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::Touch)(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) |
Touch() Updates time stamps for the file opened by this FileIO object. This function will fail if the FileIO object has not been opened. The FileIO object must be opened, and there must be no other operations pending.
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
[in] | last_access_time | The last time the FileIO was accessed. |
[in] | last_modified_time | The last time the FileIO was modified. |
[in] | callback | A PP_CompletionCallback to be called upon completion of Touch(). |
pp_errors.h
. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. Definition at line 164 of file ppb_file_io.h.
int32_t(* PPB_FileIO_1_1::Write)(PP_Resource file_io, int64_t offset, const char *buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) |
Write() writes to an offset in the file. This function might perform a partial write. The FileIO object must have been opened with write access.
[in] | file_io | A PP_Resource corresponding to a file FileIO. |
[in] | offset | The offset into the file. |
[in] | buffer | The buffer to hold the specified number of bytes read. |
[in] | bytes_to_write | The number of bytes to write to offset . |
[in] | callback | A PP_CompletionCallback to be called upon completion of Write(). |
pp_errors.h
. If the return value is 0, then end-of-file was reached. It is valid to call Write() multiple times with a completion callback to queue up parallel writes to the file, but pending writes cannot be interleaved with other operations. Definition at line 215 of file ppb_file_io.h.