summaryrefslogtreecommitdiff
path: root/includes/Buffer.h
blob: 99a57f0f64f0f807bca0e2402dfc884c0423f9bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <Handle.h>

namespace Balau {

class Buffer : public SeekableHandle {
  public:
      Buffer() throw (GeneralException) : m_buffer(NULL), m_bufSize(0), m_numBlocks(0) { }
    virtual void close() throw (GeneralException);
    virtual ssize_t read(void * buf, size_t count) throw (GeneralException);
    virtual ssize_t write(const void * buf, size_t count) throw (GeneralException);
    virtual bool isClosed();
    virtual bool canRead();
    virtual bool canWrite();
    virtual const char * getName();
    virtual off_t getSize();
    void reset();
  private:
    uint8_t * m_buffer;
    off_t m_bufSize, m_numBlocks;
};

};