|
PLCnext API Documentation 23.3.0.32
|
Exposes a Stream around a file, supporting read and write operations. More...
#include <FileStream.hpp>

Public Types | |
| using | IFileService = Arp::System::Ve::IFileService |
Public Member Functions | |
| FileStream (const String &path, FileMode mode) | |
| Initializes a new instance of the FileStream class. More... | |
| FileStream (const String &path, FileMode mode, FileAccess access) | |
| Initializes a new instance of the FileStream class. After close operation, the synchronization of the file system will be enforced for this file. More... | |
| FileStream (const String &path, FileMode mode, FileAccess access, bool sync) | |
| Initializes a new instance of the FileStream class. More... | |
| FileStream (const FileStream &arg)=delete | |
| Copy constructor. | |
| FileStream & | operator= (const FileStream &arg)=delete |
| Assignment operator. | |
| ~FileStream (void) override | |
| Destructs this instance and frees all resources. | |
| boolean | CanRead (void) override |
| Checks if the stream is opened for read-access. More... | |
| boolean | CanWrite (void) override |
| Checks if the stream is opened for write-access. More... | |
| boolean | CanSeek (void) override |
| Checks if seek operations are possible. More... | |
| size_t | GetLength (void) override |
| Returns the size of the opened file in bytes. More... | |
| void | SetLength (size_t length) override |
| Reserves a specific amount of bytes for the opened file. More... | |
| size_t | GetPosition (void) override |
| Returns the byte offset of the internal stream pointer from the beginning of the file. More... | |
| void | SetPosition (size_t position) override |
| Sets a new position of the internal stream pointer. More... | |
| void | Flush (void) override |
| Forces a write of all possibly buffered data (input stream) or discards any buffered not yet read by the user (output stream). More... | |
| size_t | Seek (size_t offset, SeekOrigin origin) override |
| Sets a new position if the internal stream pointer relative to a specific position. More... | |
| size_t | Read (byte *pBuffer, size_t bufferSize, size_t offset, size_t count) override |
| Reads data from stream into assigned buffer at a specific offset. More... | |
| void | Write (const byte *pBuffer, size_t bufferSize, size_t offset, size_t count) override |
| Writes data from assigned buffer to stream. More... | |
Public Member Functions inherited from Arp::System::Commons::Io::Stream | |
| Stream (void) | |
| Constructs an Stream instance. | |
| Stream (const Stream &arg)=delete | |
| Copy constructor. | |
| Stream & | operator= (const Stream &arg)=delete |
| Assignment operator. | |
| virtual | ~Stream (void) |
| Destructs this instance and frees all resources. | |
| virtual boolean | CanRead (void)=0 |
| virtual boolean | CanWrite (void)=0 |
| virtual boolean | CanSeek (void)=0 |
| virtual size_t | GetLength (void)=0 |
| virtual void | SetLength (size_t length)=0 |
| virtual size_t | GetPosition (void)=0 |
| virtual void | SetPosition (size_t position)=0 |
| virtual void | Flush (void)=0 |
| virtual size_t | Seek (size_t offset, SeekOrigin origin)=0 |
| virtual size_t | Read (byte *pBuffer, size_t bufferSize, size_t offset, size_t count)=0 |
| virtual void | Write (const byte *pBuffer, size_t bufferSize, size_t offset, size_t count)=0 |
| virtual byte | ReadByte (void) |
| virtual void | WriteByte (byte value) |
| virtual void | CopyTo (Stream &other) |
| void | Dispose (void) |
| void | Close (void) |
Protected Member Functions | |
| void | InternalDispose (void) override |
Protected Member Functions inherited from Arp::System::Commons::Io::Stream | |
| boolean | IsDisposed (void) |
| void | CheckDisposed (void) |
| virtual void | InternalDispose (void)=0 |
Additional Inherited Members | |
Static Public Attributes inherited from Arp::System::Commons::Io::Stream | |
| static NullStream | Empty |
Exposes a Stream around a file, supporting read and write operations.
Initializes a new instance of the FileStream class.
The file is opened or created with read-write permissions.
| path | The path of the file to open.. |
| mode | The open mode. |
| Arp::System::Commons::ArgumentException | if path is an empty string. |
| Arp::System::Commons::Io::AlreadyExistsException | if #Arp::Syste::Commons::Io::FileMode::CreateNew is chosen and the file does already exists. |
| Arp::System::Commons::Io::NotExistException | if a file should be opened that does not exist. |
| Arp::System::Commons::Io::InvalidPathException | in case an error occured that is not already handled by the other exceptions. |
|
inline |
Initializes a new instance of the FileStream class. After close operation, the synchronization of the file system will be enforced for this file.
| path | The path of the file to open.. |
| mode | The open mode. |
| access | The access mode. |
| Arp::System::Commons::ArgumentException | if path is an empty string. |
| Arp::System::Commons::Io::AlreadyExistsException | if #Arp::Syste::Commons::Io::FileMode::CreateNew is chosen and the file does already exists. |
| Arp::System::Commons::Io::NotExistException | if a file should be opened that does not exist. |
| Arp::System::Commons::Io::InvalidPathException | in case an error occured that is not already handled by the other exceptions. |
|
inline |
Initializes a new instance of the FileStream class.
| path | The path of the file to open.. |
| mode | The open mode. |
| access | The access mode. |
| sync | If set to true, the synchronization of the file system is enforced after close operation for this file. |
| Arp::System::Commons::ArgumentException | if path is an empty string. |
| Arp::System::Commons::Io::AlreadyExistsException | if #Arp::Syste::Commons::Io::FileMode::CreateNew is chosen and the file does already exists. |
| Arp::System::Commons::Io::NotExistException | if a file should be opened that does not exist. |
| Arp::System::Commons::Io::InvalidPathException | in case an error occured that is not already handled by the other exceptions. |
|
overridevirtual |
Checks if the stream is opened for read-access.
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Checks if seek operations are possible.
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Checks if the stream is opened for write-access.
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Forces a write of all possibly buffered data (input stream) or discards any buffered not yet read by the user (output stream).
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Returns the size of the opened file in bytes.
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Returns the byte offset of the internal stream pointer from the beginning of the file.
The next read or write operation will be performed from this byte offset on.
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
Implements Arp::System::Commons::Io::Stream.
|
overrideprotectedvirtual |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Reads data from stream into assigned buffer at a specific offset.
| pBuffer | Buffer where read data can be stored. |
| bufferSize | Maximal capacity of buffer pBuffer. |
| offset | Offset in pBuffer where read data should be stored. |
| count | Amount of bytes to read from stream. |
| Arp::System::Commons::ArgumentNullException | if pBuffer is nullptr. |
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
| Arp::System::Commons::ArgumentOutOfRangeException | if offset plus count is greater than bufferSize. |
| Arp::System::Commons::NotSupportedException | if this stream is not readable. |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Sets a new position if the internal stream pointer relative to a specific position.
| offset | Offset in byte from the reference position, can also be negativ. |
| origin | Reference from where the offset is added to calculate the new position of the file stream pointer. |
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Reserves a specific amount of bytes for the opened file.
This method is not supported for FileStream class instances.
| Arp::System::Commons::NotSupportedException |
| length | Desired byte-size of opened file. |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Sets a new position of the internal stream pointer.
The assigned position value is interpreted as a byte offset from the beginning of the opened file.
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
| position | Byte-offset for the internal stream pointer from the beginning of the file. |
Implements Arp::System::Commons::Io::Stream.
|
overridevirtual |
Writes data from assigned buffer to stream.
| pBuffer | Pointer to data-location. |
| bufferSize | Amount of bytes stored inpBuffer |
| offset | Byte offset from location pBuffer where storing of data starts. |
| count | Amount of bytes to be store via FileStream. Data from offset to offset + count will be stored. |
| Arp::System::Commons::ArgumentNullException | if pBuffer is nullptr. |
| Arp::System::Commons::ObjectDisposedException | if the stream was already disposed. |
| Arp::System::Commons::ArgumentOutOfRangeException | if offset plus count is greater than bufferSize. |
| Arp::System::Commons::NotSupportedException | if this stream is not writeable. |
Implements Arp::System::Commons::Io::Stream.