Asio Extensions
Additional functionality built on top of (Boost.)Asio
|
Basic interface for (a)synchronous file I/O. More...
#include <asioext/basic_file.hpp>
Public Types | |
typedef FileService::native_handle_type | native_handle_type |
The operating system's native file handle type. More... | |
typedef basic_file | lowest_layer_type |
A basic_file is always the lowest layer. More... | |
Public Member Functions | |
basic_file (asio::io_service &io_service) noexcept | |
Construct an unopened file. More... | |
basic_file (asio::io_service &io_service, const file_handle &handle) noexcept | |
Construct a file using a native handle object. More... | |
basic_file (asio::io_service &io_service, const native_handle_type &handle) noexcept | |
Construct a file using a native handle object. More... | |
basic_file (asio::io_service &io_service, const char *filename, open_flags flags, file_perms perms=file_perms::create_default, file_attrs attrs=file_attrs::none) | |
Open a file and construct a basic_file. More... | |
basic_file (asio::io_service &io_service, const char *filename, open_flags flags, file_perms perms, file_attrs attrs, error_code &ec) noexcept | |
Open a file and construct a basic_file. More... | |
basic_file (asio::io_service &io_service, const wchar_t *filename, open_flags flags, file_perms perms=file_perms::create_default, file_attrs attrs=file_attrs::none) | |
Open a file and construct a basic_file. More... | |
basic_file (asio::io_service &io_service, const wchar_t *filename, open_flags flags, file_perms perms, file_attrs attrs, error_code &ec) noexcept | |
Open a file and construct a basic_file. More... | |
basic_file (asio::io_service &io_service, const boost::filesystem::path &filename, open_flags flags, file_perms perms=file_perms::create_default, file_attrs attrs=file_attrs::none) | |
Open a file and construct a basic_file. More... | |
basic_file (asio::io_service &io_service, const boost::filesystem::path &filename, open_flags flags, file_perms perms, file_attrs attrs, error_code &ec) noexcept | |
Open a file and construct a basic_file. More... | |
lowest_layer_type & | lowest_layer () noexcept |
Get a reference to the lowest layer. More... | |
const lowest_layer_type & | lowest_layer () const noexcept |
Get a const reference to the lowest layer. More... | |
native_handle_type | native_handle () noexcept |
Get the native handle representation. More... | |
void | cancel () |
Cancel all asynchronous operations associated with the file. More... | |
void | cancel (error_code &ec) noexcept |
Cancel all asynchronous operations associated with the file. More... | |
Handle-management functions | |
void | open (const char *filename, open_flags flags, file_perms perms=file_perms::create_default, file_attrs attrs=file_attrs::none) |
Open a file. More... | |
void | open (const char *filename, open_flags flags, file_perms perms, file_attrs attrs, error_code &ec) noexcept |
Open a file. More... | |
void | open (const wchar_t *filename, open_flags flags, file_perms perms=file_perms::create_default, file_attrs attrs=file_attrs::none) |
Open a file. More... | |
void | open (const wchar_t *filename, open_flags flags, file_perms perms, file_attrs attrs, error_code &ec) noexcept |
Open a file. More... | |
void | open (const boost::filesystem::path &filename, open_flags flags, file_perms perms=file_perms::create_default, file_attrs attrs=file_attrs::none) |
Open a file. More... | |
void | open (const boost::filesystem::path &filename, open_flags flags, file_perms perms, file_attrs attrs, error_code &ec) noexcept |
Open a file. More... | |
bool | is_open () const noexcept |
Determine whether the handle is open. More... | |
void | close () |
Close the handle. More... | |
void | close (error_code &ec) noexcept |
Close the handle. More... | |
Positioning functions | |
uint64_t | position () |
Get the current file position. More... | |
uint64_t | position (error_code &ec) noexcept |
Get the current file position. More... | |
uint64_t | seek (seek_origin origin, int64_t offset) |
Change the read/write position. More... | |
uint64_t | seek (seek_origin origin, int64_t offset, error_code &ec) noexcept |
Change the read/write position. More... | |
Metadata functions | |
uint64_t | size () |
Get the size of a file. More... | |
uint64_t | size (error_code &ec) noexcept |
Get the size of a file. More... | |
void | size (uint64_t new_size) |
Set the size of a file. More... | |
void | size (uint64_t new_size, error_code &ec) noexcept |
Set the size of a file. More... | |
file_perms | permissions () |
Get the file's current access permissions. More... | |
file_perms | permissions (error_code &ec) noexcept |
Get the file's current access permissions. More... | |
void | permissions (file_perms perms, file_perm_options opts=file_perm_options::replace) |
Change file access permissions. More... | |
void | permissions (file_perms perms, error_code &ec) noexcept |
Change file access permissions. More... | |
void | permissions (file_perms perms, file_perm_options opts, error_code &ec) noexcept |
Change file access permissions. More... | |
file_attrs | attributes () |
Get the file's attributes. More... | |
file_attrs | attributes (error_code &ec) noexcept |
Get the file's attributes. More... | |
void | attributes (file_attrs attrs, file_attr_options opts=file_attr_options::replace) |
Change the file's attributes. More... | |
void | attributes (file_attrs attrs, error_code &ec) noexcept |
Change the file's attributes. More... | |
void | attributes (file_attrs attrs, file_attr_options opts, error_code &ec) noexcept |
Change the file's attributes. More... | |
file_times | times () |
Get the file's time data. More... | |
file_times | times (error_code &ec) noexcept |
Get the file's time data. More... | |
void | times (const file_times &new_times) |
Change a file's time data. More... | |
void | times (const file_times &new_times, error_code &ec) noexcept |
Change a file's time data. More... | |
SyncReadStream functions | |
template<typename MutableBufferSequence > | |
std::size_t | read_some (const MutableBufferSequence &buffers) |
Read some data from the file. More... | |
template<typename MutableBufferSequence > | |
std::size_t | read_some (const MutableBufferSequence &buffers, error_code &ec) noexcept |
Read some data from the file. More... | |
SyncWriteStream functions | |
template<typename ConstBufferSequence > | |
std::size_t | write_some (const ConstBufferSequence &buffers) |
Write some data to the file. More... | |
template<typename ConstBufferSequence > | |
std::size_t | write_some (const ConstBufferSequence &buffers, error_code &ec) noexcept |
Write some data to the file. More... | |
SyncRandomAccessReadDevice functions | |
template<typename MutableBufferSequence > | |
std::size_t | read_some_at (uint64_t offset, const MutableBufferSequence &buffers) |
Read some data from the file at the specified offset. More... | |
template<typename MutableBufferSequence > | |
std::size_t | read_some_at (uint64_t offset, const MutableBufferSequence &buffers, error_code &ec) noexcept |
Read some data from the file at the specified offset. More... | |
SyncRandomAccessWriteDevice functions | |
template<typename ConstBufferSequence > | |
std::size_t | write_some_at (uint64_t offset, const ConstBufferSequence &buffers) |
Write some data to the file at the specified offset. More... | |
template<typename ConstBufferSequence > | |
std::size_t | write_some_at (uint64_t offset, const ConstBufferSequence &buffers, error_code &ec) noexcept |
Write some data to the file at the specified offset. More... | |
AsyncReadStream functions | |
template<typename MutableBufferSequence , typename ReadHandler > | |
void_or_deduced | async_read_some (const MutableBufferSequence &buffers, ReadHandler &&handler) |
AsyncWriteStream functions | |
template<typename ConstBufferSequence , typename WriteHandler > | |
void_or_deduced | async_write_some (const ConstBufferSequence &buffers, WriteHandler &&handler) |
Start an asynchronous write. More... | |
AsyncRandomAccessReadDevice functions | |
template<typename MutableBufferSequence , typename ReadHandler > | |
void_or_deduced | async_read_some_at (uint64_t offset, const MutableBufferSequence &buffers, ReadHandler &&handler) |
Start an asynchronous read at the specified offset. More... | |
AsyncRandomAccessWriteDevice functions | |
template<typename ConstBufferSequence , typename WriteHandler > | |
void_or_deduced | async_write_some_at (uint64_t offset, const ConstBufferSequence &buffers, WriteHandler &&handler) |
Start an asynchronous write at the specified offset. More... | |
Basic interface for (a)synchronous file I/O.
This class template provides a generic interface for (a)synchronous file I/O.
basic_file models the following asio concepts:
typedef basic_file asioext::basic_file< FileService >::lowest_layer_type |
A basic_file is always the lowest layer.
typedef FileService::native_handle_type asioext::basic_file< FileService >::native_handle_type |
The operating system's native file handle type.
|
inlineexplicitnoexcept |
Construct an unopened file.
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
|
inlinenoexcept |
Construct a file using a native handle object.
This constructor takes ownership of the given wrapped native handle.
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
handle | The native handle object, wrapped in a file_handle, which shall be assigned to this basic_file object. |
|
inlinenoexcept |
Construct a file using a native handle object.
This constructor takes ownership of the given native handle.
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
handle | The native handle object which shall be assigned to this basic_file object. |
|
inline |
Open a file and construct a basic_file.
This constructor opens a new handle to the given file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
filename | The path of the file to open. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Open a file and construct a basic_file.
This constructor opens a new handle to the given file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
filename | The path of the file to open. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Open a file and construct a basic_file.
This constructor opens a new handle to the given file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
filename | The path of the file to open. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Open a file and construct a basic_file.
This constructor opens a new handle to the given file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
filename | The path of the file to open. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Open a file and construct a basic_file.
This constructor opens a new handle to the given file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
filename | The path of the file to open. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Open a file and construct a basic_file.
This constructor opens a new handle to the given file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
io_service | The io_service object that the file will use to dispatch handlers for any asynchronous operations performed on it. |
filename | The path of the file to open. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Start an asynchronous read.
This function is used to asynchronously read data from the file. The function call always returns immediately.
buffers | One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using asio::io_service::post(). |
asio::async_read
function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.asio::buffer
function as follows: See the asio::buffer documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
|
inline |
Start an asynchronous read at the specified offset.
This function is used to asynchronously read data from the file. The function call always returns immediately.
offset | The offset at which the data will be read. |
buffers | One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using asio::io_service::post(). |
|
inline |
Start an asynchronous write.
This function is used to asynchronously write data to the file. The function call always returns immediately.
buffers | One or more data buffers to be written to the file. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using asio::io_service::post(). |
asio::async_write
function if you need to ensure that all data is written before the asynchronous operation completes.asio::buffer
function as follows: See the asio::buffer documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
|
inline |
Start an asynchronous write at the specified offset.
This function is used to asynchronously write data to the file. The function call always returns immediately.
offset | The offset at which the data will be written. |
buffers | One or more data buffers to be written to the file. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using asio::io_service::post(). |
|
inline |
Get the file's attributes.
This function returns the file's attributes as a file_attrs
bitmask.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Get the file's attributes.
This function returns the file's attributes as a file_attrs
bitmask.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Change the file's attributes.
This function changes the file's attributes. Depending on whether file_attr_options::add_attrs
, file_attr_options::remove_attrs
are set, attributes are either added, removed or replaced.
attrs | Attributes to set, add or remove. |
opts | Options controlling this function's behavior. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Change the file's attributes.
This function changes the file's attributes. Depending on whether file_attr_options::add_attrs
, file_attr_options::remove_attrs
are set, attributes are either added, removed or replaced.
attrs | Attributes to set, add or remove. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inlinenoexcept |
Change the file's attributes.
This function changes the file's attributes. Depending on whether file_attr_options::add_attrs
, file_attr_options::remove_attrs
are set, attributes are either added, removed or replaced.
attrs | Attributes to set, add or remove. |
opts | Options controlling this function's behavior. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Cancel all asynchronous operations associated with the file.
This function causes all outstanding asynchronous write and read operations to finish immediately, and the handlers for cancelled operations will be passed the asio::error::operation_aborted error.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Cancel all asynchronous operations associated with the file.
This function causes all outstanding asynchronous write and read operations to finish immediately, and the handlers for cancelled operations will be passed the asio::error::operation_aborted error.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Close the handle.
This function is used to close the handle.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Close the handle.
This function is used to close the handle.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inlinenoexcept |
Determine whether the handle is open.
|
inlinenoexcept |
Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of layers. Since a basic_file cannot contain any further layers, it simply returns a reference to itself.
|
inlinenoexcept |
Get a const reference to the lowest layer.
This function returns a const reference to the lowest layer in a stack of layers. Since a basic_file cannot contain any further layers, it simply returns a reference to itself.
|
inlinenoexcept |
Get the native handle representation.
This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
|
inline |
Open a file.
This function closes any currently held handle and attempts to open a handle to the specified file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
filename | The path of the file to open. See Filenames for details. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Open a file.
This function closes any currently held handle and attempts to open a handle to the specified file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
filename | The path of the file to open. See Filenames for details. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Open a file.
This function closes any currently held handle and attempts to open a handle to the specified file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
filename | The path of the file to open. See Filenames for details. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Open a file.
This function closes any currently held handle and attempts to open a handle to the specified file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
filename | The path of the file to open. See Filenames for details. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Open a file.
This function closes any currently held handle and attempts to open a handle to the specified file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
filename | The path of the file to open. See Filenames for details. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
asio::system_error | Thrown on failure. |
ASIOEXT_HAS_BOOST_FILESYSTEM
is defined)
|
inlinenoexcept |
Open a file.
This function closes any currently held handle and attempts to open a handle to the specified file.
For details, see open(const char*,open_flags,file_perms,file_attrs)
filename | The path of the file to open. See Filenames for details. |
flags | Flags used to open the file. For a detailed reference, see asioext::open_flags. |
perms | Permissions for newly created files. Unused if an existing file is opened. Defaults to file_perms::create_default. |
attrs | Attributes for newly created files. Unused if an existing file is opened. Defaults to file_attrs::none. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
ASIOEXT_HAS_BOOST_FILESYSTEM
is defined)
|
inline |
Get the file's current access permissions.
This function returns the file's current access permissions as a file_perms
bitmask.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Get the file's current access permissions.
This function returns the file's current access permissions as a file_perms
bitmask.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Change file access permissions.
This function changes the file's access permissions. Depending on whether file_perm_options::add_perms
, file_perm_options::remove_perms
are set, permissions are either added, removed or replaced.
perms | Permissions to set, add or remove. |
opts | Options controlling this function's behavior. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Change file access permissions.
This function changes the file's access permissions. Depending on whether file_perm_options::add_perms
, file_perm_options::remove_perms
are set, permissions are either added, removed or replaced.
perms | Permissions to set, add or remove. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inlinenoexcept |
Change file access permissions.
This function changes the file's access permissions. Depending on whether file_perm_options::add_perms
, file_perm_options::remove_perms
are set, permissions are either added, removed or replaced.
perms | Permissions to set, add or remove. |
opts | Options controlling this function's behavior. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Get the current file position.
This function retrieves the current read/write position of this file handle, relative to the file's beginning.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Get the current file position.
This function retrieves the current read/write position of this file handle, relative to the file's beginning.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Read some data from the file.
This function is used to read data from the file, starting at the basic_file's current file position. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
buffers | One or more buffers into which the data will be read. |
asio::system_error | Thrown on failure. An error code of asio::error::eof indicates that the end of file was reached. |
asio::read
function if you need to ensure that the requested amount of data is read before the blocking operation completes.asio::buffer
function as follows: asio::buffer
documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
|
inlinenoexcept |
Read some data from the file.
This function is used to read data from the file, starting at the basic_file's current file position. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
buffers | One or more buffers into which the data will be read. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
asio::read
function if you need to ensure that the requested amount of data is read before the blocking operation completes.
|
inline |
Read some data from the file at the specified offset.
This function is used to read data from the file. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
offset | The offset at which the data will be read, relative to the file's beginning. |
buffers | One or more buffers into which the data will be read. |
asio::system_error | Thrown on failure. An error code of asio::error::eof indicates that the end of the file was reached. |
asio::read_at
function if you need to ensure that the requested amount of data is read before the blocking operation completes.asio::buffer
function as follows: asio::buffer
documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
|
inlinenoexcept |
Read some data from the file at the specified offset.
This function is used to read data from the file. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
offset | The offset at which the data will be read, relative to the file's beginning. |
buffers | One or more buffers into which the data will be read. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
asio::read_at
function if you need to ensure that the requested amount of data is read before the blocking operation completes.
|
inline |
Change the read/write position.
This function repositions the current read/write position of this basic_file by offset
, relative to the origin specified by origin
.
origin | The origin of offset . |
offset | The offset by which the current position's modified. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Change the read/write position.
This function repositions the current read/write position of this basic_file by offset
, relative to the origin specified by origin
.
origin | The origin of offset . |
offset | The offset by which the current position's modified. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Get the size of a file.
This function retrieves the size of a file, in bytes.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Get the size of a file.
This function retrieves the size of a file, in bytes.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Set the size of a file.
This function resizes the file so its new size matches new_size
.
new_size | The new total size of the file (in bytes). |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Set the size of a file.
This function resizes the file so its new size matches new_size
.
new_size | The new total size of the file (in bytes). |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Get the file's time data.
This function retrieves the various times associated with a file and copies them into a file_times
structure.
Times in the file_times struct that are not available for this file are zero-initialized.
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Get the file's time data.
This function retrieves the various times associated with a file and copies them into a file_times
structure.
Times in the file_times struct that are not available for this file are zero-initialized.
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Change a file's time data.
This function replaces a file's time data with the given values. File times that are set to zero inside the file_times
structure remain unchanged.
new_times | The new file times. Zero values are ignored. |
asio::system_error | Thrown on failure. |
|
inlinenoexcept |
Change a file's time data.
This function replaces a file's time data with the given values. File times that are set to zero inside the file_times
structure remain unchanged.
new_times | The new file times. Zero values are ignored. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
|
inline |
Write some data to the file.
This function is used to write data to the file, starting at the basic_file's current file position. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
buffers | One or more data buffers to be written to the file. |
asio::system_error | Thrown on failure. |
asio::write
function if you need to ensure that all data is written before the blocking operation completes.asio::buffer
function as follows: asio::buffer
documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
|
inlinenoexcept |
Write some data to the file.
This function is used to write data to the file, starting at the basic_file's current file position. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
buffers | One or more data buffers to be written to the file. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
asio::write
function if you need to ensure that all data is written before the blocking operation completes.
|
inline |
Write some data to the file at the specified offset.
This function is used to write data to the file. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
offset | The offset at which the data will be written, relative to the file's beginning. |
buffers | One or more data buffers to be written. |
asio::system_error | Thrown on failure. |
asio::write_at
function if you need to ensure that all data is written before the blocking operation completes.asio::buffer
function as follows: asio::buffer
documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
|
inlinenoexcept |
Write some data to the file at the specified offset.
This function is used to write data to the file. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
offset | The offset at which the data will be written, relative to the file's beginning. |
buffers | One or more data buffers to be written to the handle. |
ec | Set to indicate what error occurred. If no error occurred, the object is reset. |
asio::write_at
function if you need to ensure that all data is written before the blocking operation completes.