Commit 1c2fb362 authored by Ross Light's avatar Ross Light

Add getFd method to FdInputStream and FdOutputStream

These methods are useful if you're receiving a generic stream in
application code and would like to check some non-stream behavior about
the file (e.g. stat or isatty).  Of course, downcasting can fail and
code should not rely on the file descriptor being available.
parent 4bfcf573
......@@ -304,6 +304,8 @@ public:
size_t tryRead(void* buffer, size_t minBytes, size_t maxBytes) override;
inline int getFd() const { return fd; }
private:
int fd;
AutoCloseFd autoclose;
......@@ -321,6 +323,8 @@ public:
void write(const void* buffer, size_t size) override;
void write(ArrayPtr<const ArrayPtr<const byte>> pieces) override;
inline int getFd() const { return fd; }
private:
int fd;
AutoCloseFd autoclose;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment