#include <polyglot_file_system.h>
◆ ~ISeekable_channel()
virtual shcore::polyglot::ISeekable_channel::~ISeekable_channel |
( |
| ) |
|
|
virtualdefault |
◆ close()
virtual void shcore::polyglot::ISeekable_channel::close |
( |
| ) |
|
|
pure virtual |
Closes this channel.
After a channel is closed, any further attempt to invoke I/O operations upon it will cause a ClosedChannelException to be thrown.
If this channel is already closed then invoking this method has no effect.
This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
- Exceptions
-
IOException | If an I/O error occurs |
Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.
◆ is_open()
virtual bool shcore::polyglot::ISeekable_channel::is_open |
( |
| ) |
|
|
pure virtual |
◆ position()
virtual int64_t shcore::polyglot::ISeekable_channel::position |
( |
| ) |
|
|
pure virtual |
◆ read()
virtual int64_t shcore::polyglot::ISeekable_channel::read |
( |
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Reads a sequence of bytes from this channel into the given buffer.
Bytes are read starting at this channel's current position, and then the position is updated with the number of bytes actually read. Otherwise this method behaves exactly as specified in the ReadableByteChannel interface.
- Exceptions
-
ClosedChannelException | |
AsynchronousCloseException | |
ClosedByInterruptException | |
NonReadableChannelException | |
Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.
◆ set_position()
virtual ISeekable_channel & shcore::polyglot::ISeekable_channel::set_position |
( |
int64_t |
new_position | ) |
|
|
pure virtual |
Sets this channel's position.
Setting the position to a value that is greater than the current size is legal but does not change the size of the entity. A later attempt to read bytes at such a position will immediately return an end-of-file indication. A later attempt to write bytes at such a position will cause the entity to grow to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
Setting the channel's position is not recommended when connected to an entity, typically a file, that is opened with the APPEND option. When opened for append, the position is first advanced to the end before writing.
- Parameters
-
new_position | The new position, a non-negative integer counting the number of bytes from the beginning of the entity |
- Returns
- This channel
- Exceptions
-
ClosedChannelException | If this channel is closed |
IllegalArgumentException | If the new position is negative |
IOException | If some other I/O error occurs |
Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.
◆ size()
virtual int64_t shcore::polyglot::ISeekable_channel::size |
( |
| ) |
|
|
pure virtual |
◆ truncate()
virtual ISeekable_channel & shcore::polyglot::ISeekable_channel::truncate |
( |
int64_t |
size | ) |
|
|
pure virtual |
Truncates the entity, to which this channel is connected, to the given size.
If the given size is less than the current size then the entity is truncated, discarding any bytes beyond the new end. If the given size is greater than or equal to the current size then the entity is not modified. In either case, if the current position is greater than the given size then it is set to that size.
An implementation of this interface may prohibit truncation when connected to an entity, typically a file, opened with the APPEND option.
- Parameters
-
size | The new size, a non-negative byte count |
- Returns
- This channel
- Exceptions
-
NonWritableChannelException | If this channel was not opened for writing |
ClosedChannelException | If this channel is closed |
IllegalArgumentException | If the new size is negative |
IOException | If some other I/O error occurs |
Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.
◆ write()
virtual int64_t shcore::polyglot::ISeekable_channel::write |
( |
const char * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Writes a sequence of bytes to this channel from the given buffer.
Bytes are written starting at this channel's current position, unless the channel is connected to an entity such as a file that is opened with the APPEND option, in which case the position is first advanced to the end. The entity to which the channel is connected is grown, if necessary, to accommodate the written bytes, and then the position is updated with the number of bytes actually written. Otherwise this method behaves exactly as specified by the WritableByteChannel interface.
- Exceptions
-
ClosedChannelException | |
AsynchronousCloseException | |
ClosedByInterruptException | |
NonWritableChannelException | |
Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.
The documentation for this class was generated from the following file: