FileStream class final
Contents
Class to represent a file stream open as read, write or random access
Base classes
- class IInputStream
- class IOutputStream
Constructors, destructors, conversion operators
- FileStream(const File& file, fint mode)
- FileStream(FileStream&& other) noexcept
- ~FileStream() final
- FileStream(const FileStream& other) deleted
Public functions
- auto operator=(const FileStream& other) -> FileStream& deleted
- auto operator=(FileStream&& other) -> FileStream& noexcept
- void SeekOffset(int64 offset) const
- void Seek(uint64 pos) const
- void Close()
- auto Read(void* buf, fsize bufsize) -> fsize final
- auto Write(const void* buf, fsize bufsize) -> fsize final
Function documentation
bpf:: io:: FileStream:: FileStream(const File& file,
fint mode)
| Parameters | |
|---|---|
| file | file to open |
| mode | file mode and flags or'ed (ex : FILE_MODE_READ | FILE_MODE_WRITE) |
| Exceptions | |
| IOException | in case of system error |
Creates a new FileStream from the given file and mode
bpf:: io:: FileStream:: FileStream(FileStream&& other) noexcept
Move constructor
bpf:: io:: FileStream:: FileStream(const FileStream& other) deleted
Cannot copy a FileStream
FileStream& bpf:: io:: FileStream:: operator=(const FileStream& other) deleted
Cannot copy a FileStream
FileStream& bpf:: io:: FileStream:: operator=(FileStream&& other) noexcept
Move assignment operator
void bpf:: io:: FileStream:: SeekOffset(int64 offset) const
| Parameters | |
|---|---|
| offset | relative offset |
| Exceptions | |
| IOException | in case of system error |
Sets the file cursor position to an offset relative to the current position
void bpf:: io:: FileStream:: Seek(uint64 pos) const
| Parameters | |
|---|---|
| pos | new cursor position |
| Exceptions | |
| IOException | in case of system error |
Sets the file cursor position to pos
void bpf:: io:: FileStream:: Close()
Closes this FileStream, calling any more IO functions will throw IOException
fsize bpf:: io:: FileStream:: Read(void* buf,
fsize bufsize) final
| Parameters | |
|---|---|
| buf | buffer to receive the read bytes |
| bufsize | the size of the receiving buffer |
| Returns | number of bytes read |
| Exceptions | |
| IOException | in case of system error |
Reads bytes from this stream, no buffering is performed
fsize bpf:: io:: FileStream:: Write(const void* buf,
fsize bufsize) final
| Parameters | |
|---|---|
| buf | the buffer with the bytes to write |
| bufsize | the size of the buffer |
| Returns | number of bytes written |
| Exceptions | |
| IOException | in case of system error |
Writes bytes to this stream, no buffering is performed