diff --git a/Userland/Libraries/LibCore/IODevice.cpp b/Userland/Libraries/LibCore/IODevice.cpp index b8e156d01f..f3fef7dccf 100644 --- a/Userland/Libraries/LibCore/IODevice.cpp +++ b/Userland/Libraries/LibCore/IODevice.cpp @@ -110,11 +110,6 @@ bool IODevice::can_read_line() const } } -bool IODevice::can_read() const -{ - return !m_buffered_data.is_empty() || can_read_from_fd(); -} - ByteBuffer IODevice::read_all() { off_t file_size = 0; @@ -262,16 +257,6 @@ bool IODevice::seek(i64 offset, SeekMode mode, off_t* pos) return true; } -bool IODevice::truncate(off_t size) -{ - int rc = ftruncate(m_fd, size); - if (rc < 0) { - set_error(errno); - return false; - } - return true; -} - bool IODevice::write(u8 const* data, int size) { int rc = ::write(m_fd, data, size); @@ -289,12 +274,6 @@ void IODevice::set_fd(int fd) return; m_fd = fd; - did_update_fd(fd); -} - -bool IODevice::write(StringView v) -{ - return write((u8 const*)v.characters_without_null_termination(), v.length()); } } diff --git a/Userland/Libraries/LibCore/IODevice.h b/Userland/Libraries/LibCore/IODevice.h index d46e0fcd15..2cc825a2e6 100644 --- a/Userland/Libraries/LibCore/IODevice.h +++ b/Userland/Libraries/LibCore/IODevice.h @@ -34,14 +34,11 @@ public: int fd() const { return m_fd; } OpenMode mode() const { return m_mode; } - bool is_open() const { return m_mode != OpenMode::NotOpen; } bool eof() const { return m_eof; } int error() const { return m_error; } char const* error_string() const; - bool has_error() const { return m_error != 0; } - int read(u8* buffer, int length); ByteBuffer read(size_t max_size); @@ -49,15 +46,9 @@ public: DeprecatedString read_line(size_t max_size = 16384); bool write(u8 const*, int size); - bool write(StringView); - - bool truncate(off_t); bool can_read_line() const; - bool can_read() const; - bool can_read_only_from_buffer() const { return !m_buffered_data.is_empty() && !can_read_from_fd(); } - bool seek(i64, SeekMode = SeekMode::SetPosition, off_t* = nullptr); virtual bool open(OpenMode) = 0; @@ -71,8 +62,6 @@ protected: void set_error(int error) const { m_error = error; } void set_eof(bool eof) const { m_eof = eof; } - virtual void did_update_fd(int) { } - private: bool populate_read_buffer(size_t size = 1024) const; bool can_read_from_fd() const;