MySQL 9.3.0
Source Code Documentation
shcore::polyglot::ISeekable_channel Class Referenceabstract

#include <polyglot_file_system.h>

Inheritance diagram for shcore::polyglot::ISeekable_channel:
[legend]

Public Member Functions

virtual ~ISeekable_channel ()=default
 
virtual bool is_open ()=0
 Tells whether or not this channel is open. More...
 
virtual void close ()=0
 Closes this channel. More...
 
virtual int64_t read (void *buffer, size_t size)=0
 Reads a sequence of bytes from this channel into the given buffer. More...
 
virtual int64_t write (const char *buffer, size_t size)=0
 Writes a sequence of bytes to this channel from the given buffer. More...
 
virtual int64_t position ()=0
 Returns this channel's position. More...
 
virtual ISeekable_channelset_position (int64_t new_position)=0
 Sets this channel's position. More...
 
virtual int64_t size ()=0
 Returns the current size of entity to which this channel is connected. More...
 
virtual ISeekable_channeltruncate (int64_t size)=0
 Truncates the entity, to which this channel is connected, to the given size. More...
 

Constructor & Destructor Documentation

◆ ~ISeekable_channel()

virtual shcore::polyglot::ISeekable_channel::~ISeekable_channel ( )
virtualdefault

Member Function Documentation

◆ 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
IOExceptionIf 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

Tells whether or not this channel is open.

Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.

◆ position()

virtual int64_t shcore::polyglot::ISeekable_channel::position ( )
pure virtual

Returns this channel's position.

Returns
This channel's position, a non-negative integer counting the number of bytes from the beginning of the entity to the current position
Exceptions
ClosedChannelExceptionIf this channel is closed
IOExceptionIf some other I/O error occurs

Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.

◆ 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_positionThe new position, a non-negative integer counting the number of bytes from the beginning of the entity
Returns
This channel
Exceptions
ClosedChannelExceptionIf this channel is closed
IllegalArgumentExceptionIf the new position is negative
IOExceptionIf 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

Returns the current size of entity to which this channel is connected.

Returns
The current size, measured in bytes
Exceptions
ClosedChannelExceptionIf this channel is closed
IOExceptionIf some other I/O error occurs

Implemented in mrs::file_system::anonymous_namespace{db_service_file_system.cc}::File_byte_channel.

◆ 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
sizeThe new size, a non-negative byte count
Returns
This channel
Exceptions
NonWritableChannelExceptionIf this channel was not opened for writing
ClosedChannelExceptionIf this channel is closed
IllegalArgumentExceptionIf the new size is negative
IOExceptionIf 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: