class Poco::FileStreamBuf

Overview

This stream buffer handles Fileio. Moreā€¦

#include <FileStream_POSIX.h>

class FileStreamBuf: public Poco::BasicBufferedBidirectionalStreamBuf
{
public:
    // methods

    void
    open(
        const std::string& path,
        std::ios::openmode mode
        );

    bool
    close();

    std::streampos
    seekoff(
        std::streamoff off,
        std::ios::seekdir dir,
        std::ios::openmode mode = std::ios::in|std::ios::out
        );

    std::streampos
    seekpos(
        std::streampos pos,
        std::ios::openmode mode = std::ios::in|std::ios::out
        );

protected:
    // enums

    enum
    {
        BUFFER_SIZE = 4096,
    };

    // methods

    int
    readFromDevice(
        char* buffer,
        std::streamsize length
        );

    int
    writeToDevice(
        const char* buffer,
        std::streamsize length
        );
};

Inherited Members

public:
    // methods

    virtual
    int_type
    overflow(int_type c);

    virtual
    int_type
    underflow();

    virtual
    int
    sync();

protected:
    // typedefs

    typedef std::basic_streambuf<ch, tr> Base;
    typedef std::basic_ios<ch, tr> IOS;
    typedef ch char_type;
    typedef tr char_traits;
    typedef ba Allocator;
    typedef Base::int_type int_type;
    typedef Base::pos_type pos_type;
    typedef Base::off_type off_type;
    typedef IOS::openmode openmode;

    // methods

    void
    setMode(openmode mode);

    openmode
    getMode() const;

    void
    resetBuffers();

Detailed Documentation

This stream buffer handles Fileio.

Construction

~FileStreamBuf()

Destroys the FileStream.

Methods

void
open(
    const std::string& path,
    std::ios::openmode mode
    )

Opens the given file in the given mode.

bool
close()

Closes the File stream buffer.

Returns true if successful, false otherwise.

std::streampos
seekoff(
    std::streamoff off,
    std::ios::seekdir dir,
    std::ios::openmode mode = std::ios::in|std::ios::out
    )

Change position by offset, according to way and mode.

std::streampos
seekpos(
    std::streampos pos,
    std::ios::openmode mode = std::ios::in|std::ios::out
    )

Change to specified position, according to mode.