summaryrefslogtreecommitdiff
path: root/includes/BStream.h
blob: 0e7d5f63bc97de68f944f0b8a2b332d0140232b7 (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
25
#pragma once

#include <Handle.h>

namespace Balau {

class BStream : public Filter {
  public:
      BStream(IO<Handle> h);
    virtual void close() throw (GeneralException) override;
    virtual bool isEOF() override { return (m_availBytes == 0) && Filter::isEOF(); }
    virtual const char * getName() override { return m_name.to_charp(); }
    virtual ssize_t read(void * buf, size_t count) throw (GeneralException);
    int peekNextByte();
    String readString(bool putNL = false);
    bool isEmpty() { return m_availBytes == 0; }
  private:
    uint8_t * m_buffer = NULL;
    size_t m_availBytes = 0;
    size_t m_cursor = 0;
    String m_name;
    bool m_passThru = false;
};

};