FileStream.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/data/stream/FileStream.hpp"

FileInputStream

Wrapper over std::FILE.

namespace oatpp { namespace data { namespace stream { 
  class FileInputStream : public InputStream {}
}}}

Methods

Return Type Name Summary
[none] FileInputStream Multiple implementations:
  1. Constructor.
  2. Constructor.
[none] ~FileInputStream Virtual destructor.
std::FILE* getFile Get file.
data::v_io_size read Read data from stream up to count bytes, and return number of bytes actually read.
oatpp::async::Action suggestInputStreamAction Implementation of InputStream must suggest async actions for I/O results.
void setInputStreamIOMode Set stream I/O mode.
IOMode getInputStreamIOMode Get stream I/O mode.

FileInputStream::FileInputStream

  1. Constructor.
    • @param file - file.
    • @param ownsFile - if true then call close on FileInputStream destruction.
    FileInputStream(std::FILE* file, bool ownsFile)
    
  2. Constructor.
    • @param filename - name of the file.
    FileInputStream(const char* filename)
    

FileInputStream::~FileInputStream

Virtual destructor.

~FileInputStream()

FileInputStream::getFile

Get file.

  • @return

std::FILE* getFile()

FileInputStream::read

Read data from stream up to count bytes, and return number of bytes actually read.
It is a legal case if return result < count. Caller should handle this!

  • @param data - buffer to read data to.
  • @param count - size of the buffer.
  • @return - actual number of bytes read.

data::v_io_size read(void *data, data::v_io_size count) override

FileInputStream::suggestInputStreamAction

Implementation of InputStream must suggest async actions for I/O results.
Suggested Action is used for scheduling coroutines in async::Executor.
Stream MUST always give the same file-handle if applicable

oatpp::async::Action suggestInputStreamAction(data::v_io_size ioResult) override

FileInputStream::setInputStreamIOMode

Set stream I/O mode.

  • @throws

void setInputStreamIOMode(IOMode ioMode) override

FileInputStream::getInputStreamIOMode

Get stream I/O mode.

  • @return

IOMode getInputStreamIOMode() override

FileOutputStream

Wrapper over std::FILE.

namespace oatpp { namespace data { namespace stream { 
  class FileOutputStream : public OutputStream {}
}}}

Methods

Return Type Name Summary
[none] FileOutputStream Multiple implementations:
  1. Constructor.
  2. Constructor.
[none] ~FileOutputStream Virtual destructor.
std::FILE* getFile Get file.
data::v_io_size write Write data to stream up to count bytes, and return number of bytes actually written.
oatpp::async::Action suggestOutputStreamAction Implementation of OutputStream must suggest async actions for I/O results.
void setOutputStreamIOMode Set stream I/O mode.
IOMode getOutputStreamIOMode Get stream I/O mode.

FileOutputStream::FileOutputStream

  1. Constructor.
    • @param file - file.
    • @param ownsFile - if true then call close on FileInputStream destruction.
    FileOutputStream(std::FILE* file, bool ownsFile)
    
  2. Constructor.
    • @param filename - name of the file.
    • @param mode - ("wb" - create new/override, "ab" - create new/append).
    FileOutputStream(const char* filename, const char* mode = "wb")
    

FileOutputStream::~FileOutputStream

Virtual destructor.

~FileOutputStream()

FileOutputStream::getFile

Get file.

  • @return

std::FILE* getFile()

FileOutputStream::write

Write data to stream up to count bytes, and return number of bytes actually written.
It is a legal case if return result < count. Caller should handle this!

  • @param data - data to write.
  • @param count - number of bytes to write.
  • @return - actual number of bytes written. oatpp::data::v_io_size.

data::v_io_size write(const void *data, data::v_io_size count) override

FileOutputStream::suggestOutputStreamAction

Implementation of OutputStream must suggest async actions for I/O results.
Suggested Action is used for scheduling coroutines in async::Executor.
Stream MUST always give the same file-handle if applicable

oatpp::async::Action suggestOutputStreamAction(data::v_io_size ioResult) override

FileOutputStream::setOutputStreamIOMode

Set stream I/O mode.

  • @throws

void setOutputStreamIOMode(IOMode ioMode) override

FileOutputStream::getOutputStreamIOMode

Get stream I/O mode.

  • @return

IOMode getOutputStreamIOMode() override