seekablestream.h
Go to the documentation of this file.
#ifndef _SEEKABLESTREAM_H_
#define _SEEKABLESTREAM_H_
#include <Stream.h>
#include <Arduino.h>
#define EOFchar 255
class seekableStream : public Stream
{
protected:
unsigned int streamSize;
bool textMode;
uint16_t contentType;
public:
seekableStream(unsigned int size):Stream(),streamSize(size) {};
virtual bool checkPermissions(char mode) {return true;};
unsigned int getSize() {return streamSize;}
void setSize (unsigned int size) {streamSize = size;};
virtual unsigned int seek(unsigned int _pos = 0) = 0;
virtual int open(String _filename, char mode) = 0;
virtual void close() = 0;
virtual uint16_t getContentType() {return contentType;};
virtual void putEOF() {if (textMode) write (EOFchar);};
};
#endif
seekableStream::seek
virtual unsigned int seek(unsigned int _pos=0)=0
seekableStream::checkPermissions
virtual bool checkPermissions(char mode)
Definition: seekablestream.h:18
seekableStream::seekableStream
seekableStream(unsigned int size)
Definition: seekablestream.h:17
seekableStream::setSize
void setSize(unsigned int size)
Definition: seekablestream.h:20
seekableStream::open
virtual int open(String _filename, char mode)=0
seekableStream::getContentType
virtual uint16_t getContentType()
Definition: seekablestream.h:24
seekableStream::contentType
uint16_t contentType
Definition: seekablestream.h:14
seekableStream
Definition: seekablestream.h:10
seekableStream::streamSize
unsigned int streamSize
Definition: seekablestream.h:12
seekableStream::putEOF
virtual void putEOF()
Definition: seekablestream.h:25
seekableStream::textMode
bool textMode
Definition: seekablestream.h:13
EOFchar
#define EOFchar
Definition: seekablestream.h:7
seekableStream::getSize
unsigned int getSize()
Definition: seekablestream.h:19
seekableStream::close
virtual void close()=0