DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
FileStream.h
Go to the documentation of this file.
1#pragma once
2
3#include "Common.h"
4#include "System/IO/Stream.h"
5#include "System/String.h"
6
7namespace DotNetDupe {
8 namespace System {
9 namespace IO {
16 class FileStream : public Stream {
17 public:
23 DOTNETDUPE_API FileStream(const String& sPath, int iMode);
24
26 DOTNETDUPE_API ~FileStream() override;
27
30 DOTNETDUPE_API bool CanRead() const override;
31
34 DOTNETDUPE_API bool CanSeek() const override;
35
38 DOTNETDUPE_API bool CanWrite() const override;
39
43 DOTNETDUPE_API long GetLength() const override;
44
48 DOTNETDUPE_API long GetPosition() const override;
49
53 DOTNETDUPE_API void SetPosition(long llValue) override;
54
57 DOTNETDUPE_API void Flush() override;
58
65 DOTNETDUPE_API int Read(char* pBuffer, int iOffset, int nCount) override;
66
73 DOTNETDUPE_API long Seek(long llOffset, int iOrigin) override;
74
78 DOTNETDUPE_API void SetLength(long llValue) override;
79
85 DOTNETDUPE_API void Write(const char* pBuffer, int iOffset, int nCount) override;
86
88 DOTNETDUPE_API void Dispose() override;
89
90 private:
91 struct Impl;
92 Impl* m_pImpl;
93 String m_sPath;
94 int m_iMode;
95 bool m_bCanRead;
96 bool m_bCanWrite;
97 bool m_bCanSeek;
98 };
99 }
100 }
101}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
int Read(char *pBuffer, int iOffset, int nCount) override
Reads a block of bytes from the stream and writes the data in a given buffer.
bool CanSeek() const override
Gets a value indicating whether the current stream supports seeking.
void Write(const char *pBuffer, int iOffset, int nCount) override
Writes a block of bytes to the file stream.
long Seek(long llOffset, int iOrigin) override
Sets the current position of this stream to the given value.
bool CanRead() const override
Gets a value indicating whether the current stream supports reading.
void SetPosition(long llValue) override
Sets the current position within the stream.
long GetLength() const override
Gets the length in bytes of the stream.
void Flush() override
Clears buffers for this stream and causes any unwritten data to be written to the file.
long GetPosition() const override
Gets the current position within the stream.
void SetLength(long llValue) override
Sets the length of this stream to the given value.
void Dispose() override
Releases all unmanaged resources used by the FileStream.
bool CanWrite() const override
Gets a value indicating whether the current stream supports writing.
FileStream(const String &sPath, int iMode)
Initializes a new instance of the FileStream class with the specified path and creation mode.
Provides a generic view of a sequence of bytes.
Definition Stream.h:16
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74