#endif
#endif
-//------------------------------------------------------------------------
-
-#define headerSearchSize 1024 // read this many bytes at beginning of
- // file to look for '%PDF'
-
//------------------------------------------------------------------------
// Stream (base class)
//------------------------------------------------------------------------
return buf;
}
-void Stream::setPos(int pos) {
- error(-1, "Internal: called setPos() on non-FileStream");
-}
-
GString *Stream::getPSFilter(char *indent) {
return new GString();
}
return str;
}
+//------------------------------------------------------------------------
+// BaseStream
+//------------------------------------------------------------------------
+
+BaseStream::BaseStream(Object *dict) {
+ this->dict = *dict;
+}
+
+BaseStream::~BaseStream() {
+ dict.free();
+}
+
+//------------------------------------------------------------------------
+// FilterStream
+//------------------------------------------------------------------------
+
+FilterStream::FilterStream(Stream *str) {
+ this->str = str;
+}
+
+FilterStream::~FilterStream() {
+}
+
+void FilterStream::setPos(int pos) {
+ error(-1, "Internal: called setPos() on FilterStream");
+}
+
//------------------------------------------------------------------------
// ImageStream
//------------------------------------------------------------------------
// FileStream
//------------------------------------------------------------------------
-GBool FileStream::checkHeader() {
- char hdrBuf[headerSearchSize+1];
- char *p;
- double version;
- int i;
-
- for (i = 0; i < headerSearchSize; ++i)
- hdrBuf[i] = getChar();
- hdrBuf[headerSearchSize] = '\0';
- for (i = 0; i < headerSearchSize - 5; ++i) {
- if (!strncmp(&hdrBuf[i], "%PDF-", 5))
- break;
- }
- if (i >= headerSearchSize - 5) {
- error(-1, "May not be a PDF file (continuing anyway)");
- return gFalse;
- }
- start += i;
- p = strtok(&hdrBuf[i+5], " \t\n\r");
- version = atof(p);
- if (!(hdrBuf[i+5] >= '0' && hdrBuf[i+5] <= '9') ||
- version > pdfVersionNum + 0.0001) {
- error(getPos(), "PDF version %s -- xpdf supports version %s"
- " (continuing anyway)", p, pdfVersion);
- return gFalse;
- }
- return gTrue;
-}
-
-FILE *fileOpen (GString *fileName1) {
- GString *fileName2;
- // try to open file
- fileName2 = NULL;
- FILE *file = NULL;
-
-#ifdef VMS
- if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) {
- error(-1, "Couldn't open file '%s'", fileName->getCString());
- return NULL;
- }
-#else
- if (!(file = fopen(fileName1->getCString(), "rb"))) {
- fileName2 = fileName1->copy();
- fileName2->lowerCase();
- if (!(file = fopen(fileName2->getCString(), "rb"))) {
- fileName2->upperCase();
- if (!(file = fopen(fileName2->getCString(), "rb"))) {
- error(-1, "Couldn't open file '%s'", fileName1->getCString());
- delete fileName2;
- return NULL;
- }
- }
- delete fileName2;
- }
-#endif
- return file;
-}
-
-FileStream::FileStream() {
-}
-
-FileStream::FileStream(FILE *f1) {
- f = f1;
- start = 0;
- length = -1;
+FileStream::FileStream(FILE *f, int start, int length, Object *dict):
+ BaseStream(dict) {
+ this->f = f;
+ this->start = start;
+ this->length = length;
bufPtr = bufEnd = buf;
bufPos = start;
savePos = -1;
- dict.initNull();
- if (f)
- checkHeader();
-}
-
-Stream *FileStream::subStream (int start1, int length1, Object *dict1) {
- FileStream *scp = new FileStream ();
- scp->f = f;
- scp->start = start1;
- scp->length = length1;
- scp->bufPtr = bufEnd = buf;
- scp->bufPos = start;
- scp->savePos = -1;
- scp->dict = *dict1;
- return scp;
}
FileStream::~FileStream() {
- if (savePos >= 0)
+ if (savePos >= 0) {
fseek(f, savePos, SEEK_SET);
- dict.free();
+ }
+}
+
+Stream *FileStream::makeSubStream(int start, int length, Object *dict) {
+ return new FileStream(f, start, length, dict);
}
void FileStream::reset() {
bufPtr = bufEnd = buf;
}
+void FileStream::moveStart(int delta) {
+ this->start += delta;
+ bufPtr = bufEnd = buf;
+ bufPos = start;
+}
+
//------------------------------------------------------------------------
-// SubStream
+// EmbedStream
//------------------------------------------------------------------------
-SubStream::SubStream(Stream *str1, Object *dict1) {
- str = str1;
- dict = *dict1;
+EmbedStream::EmbedStream(Stream *str, Object *dict):
+ BaseStream(dict) {
+ this->str = str;
}
-SubStream::~SubStream() {
- dict.free();
+EmbedStream::~EmbedStream() {
+}
+
+Stream *EmbedStream::makeSubStream(int start, int length, Object *dict) {
+ error(-1, "Internal: called makeSubStream() on EmbedStream");
+ return NULL;
+}
+
+void EmbedStream::setPos(int pos) {
+ error(-1, "Internal: called setPos() on EmbedStream");
+}
+
+int EmbedStream::getStart() {
+ error(-1, "Internal: called getStart() on EmbedStream");
+ return 0;
+}
+
+void EmbedStream::moveStart(int start) {
+ error(-1, "Internal: called moveStart() on EmbedStream");
}
//------------------------------------------------------------------------
// ASCIIHexStream
//------------------------------------------------------------------------
-ASCIIHexStream::ASCIIHexStream(Stream *str1) {
- str = str1;
+ASCIIHexStream::ASCIIHexStream(Stream *str):
+ FilterStream(str) {
buf = EOF;
eof = gFalse;
}
// ASCII85Stream
//------------------------------------------------------------------------
-ASCII85Stream::ASCII85Stream(Stream *str1) {
- str = str1;
+ASCII85Stream::ASCII85Stream(Stream *str):
+ FilterStream(str) {
index = n = 0;
eof = gFalse;
}
// LZWStream
//------------------------------------------------------------------------
-LZWStream::LZWStream(Stream *str1, int predictor1, int columns1, int colors1,
- int bits1, int early1) {
- str = str1;
+LZWStream::LZWStream(Stream *str, int predictor1, int columns1, int colors1,
+ int bits1, int early1):
+ FilterStream(str) {
if (predictor1 != 1) {
pred = new StreamPredictor(this, predictor1, columns1, colors1, bits1);
} else {
// RunLengthStream
//------------------------------------------------------------------------
-RunLengthStream::RunLengthStream(Stream *str1) {
- str = str1;
+RunLengthStream::RunLengthStream(Stream *str):
+ FilterStream(str) {
bufPtr = bufEnd = buf;
eof = gFalse;
}
CCITTFaxStream::CCITTFaxStream(Stream *str, int encoding, GBool endOfLine,
GBool byteAlign, int columns, int rows,
- GBool endOfBlock, GBool black) {
- this->str = str;
+ GBool endOfBlock, GBool black):
+ FilterStream(str) {
this->encoding = encoding;
this->endOfLine = endOfLine;
this->byteAlign = byteAlign;
63
};
-DCTStream::DCTStream(Stream *str1) {
+DCTStream::DCTStream(Stream *str):
+ FilterStream(str) {
int i, j;
- str = str1;
width = height = 0;
mcuWidth = mcuHeight = 0;
numComps = 0;
{13, 24577}
};
-FlateStream::FlateStream(Stream *str1, int predictor1, int columns1,
- int colors1, int bits1) {
- str = str1;
+FlateStream::FlateStream(Stream *str, int predictor1, int columns1,
+ int colors1, int bits1):
+ FilterStream(str) {
if (predictor1 != 1) {
pred = new StreamPredictor(this, predictor1, columns1, colors1, bits1);
} else {
// EOFStream
//------------------------------------------------------------------------
-EOFStream::EOFStream(Stream *str1) {
- str = str1;
+EOFStream::EOFStream(Stream *str):
+ FilterStream(str) {
}
EOFStream::~EOFStream() {
// FixedLengthEncoder
//------------------------------------------------------------------------
-FixedLengthEncoder::FixedLengthEncoder(Stream *str1, int length1) {
- str = str1;
+FixedLengthEncoder::FixedLengthEncoder(Stream *str, int length1):
+ FilterStream(str) {
length = length1;
count = 0;
}
// ASCII85Encoder
//------------------------------------------------------------------------
-ASCII85Encoder::ASCII85Encoder(Stream *str1) {
- str = str1;
+ASCII85Encoder::ASCII85Encoder(Stream *str):
+ FilterStream(str) {
bufPtr = bufEnd = buf;
lineLen = 0;
eof = gFalse;
// RunLengthEncoder
//------------------------------------------------------------------------
-RunLengthEncoder::RunLengthEncoder(Stream *str1) {
- str = str1;
+RunLengthEncoder::RunLengthEncoder(Stream *str):
+ FilterStream(str) {
bufPtr = bufEnd = nextEnd = buf;
eof = gFalse;
}
#include "gtypes.h"
#include "Object.h"
+class BaseStream;
+
//------------------------------------------------------------------------
enum StreamKind {
virtual int getPos() = 0;
// Go to a position in the stream.
- virtual void setPos(int pos1);
+ virtual void setPos(int pos1) = 0;
// Get PostScript command for the filter(s).
virtual GString *getPSFilter(char *indent);
// Does this stream type potentially contain non-printable chars?
virtual GBool isBinary(GBool last = gTrue) = 0;
- // Get the base FileStream or SubStream of this stream.
- virtual Stream *getBaseStream() = 0;
-
- // Get a substream of this stream.
- virtual Stream *subStream(int start1, int length1, Object *dict1) = 0;
-
- // Get start offset of a stream's data.
- virtual int getStart() = 0;
-
- // Whether we failed to load ?
- virtual GBool isOk() = 0;
+ // Get the BaseStream or EmbedStream of this stream.
+ virtual BaseStream *getBaseStream() = 0;
// Get the dictionary associated with this stream.
virtual Dict *getDict() = 0;
int ref; // reference count
};
+//------------------------------------------------------------------------
+// BaseStream
+//
+// This is the base class for all streams that read directly from a file.
+//------------------------------------------------------------------------
+
+class BaseStream: public Stream {
+public:
+
+ BaseStream(Object *dict);
+ virtual ~BaseStream();
+ virtual Stream *makeSubStream(int start, int length, Object *dict) = 0;
+ virtual void setPos(int pos1) = 0;
+ virtual BaseStream *getBaseStream() { return this; }
+ virtual Dict *getDict() { return dict.getDict(); }
+
+ // Get/set position of first byte of stream within the file.
+ virtual int getStart() = 0;
+ virtual void moveStart(int delta) = 0;
+
+private:
+
+ Object dict;
+};
+
+//------------------------------------------------------------------------
+// FilterStream
+//
+// This is the base class for all streams that filter another stream.
+//------------------------------------------------------------------------
+
+class FilterStream: public Stream {
+public:
+
+ FilterStream(Stream *str);
+ virtual ~FilterStream();
+ virtual int getPos() { return str->getPos(); }
+ virtual void setPos(int pos);
+ virtual BaseStream *getBaseStream() { return str->getBaseStream(); }
+ virtual Dict *getDict() { return str->getDict(); }
+
+protected:
+
+ Stream *str;
+};
+
//------------------------------------------------------------------------
// ImageStream
//------------------------------------------------------------------------
// FileStream
//------------------------------------------------------------------------
-// Portable pdf open helper function.
-extern FILE *fileOpen (GString *fileName1);
+class FileStream: public BaseStream {
+public:
-class FileStream: public Stream {
- private:
- FileStream();
- public:
- FileStream(FILE *f1);
+ FileStream(FILE *f, int start, int length, Object *dict);
virtual ~FileStream();
+ virtual Stream *makeSubStream(int start, int length, Object *dict);
virtual StreamKind getKind() { return strFile; }
virtual void reset();
virtual int getChar()
virtual int getPos() { return bufPos + (bufPtr - buf); }
virtual void setPos(int pos1);
virtual GBool isBinary(GBool last = gTrue) { return last; }
- virtual Stream *getBaseStream() { return this; }
- virtual Stream *subStream (int start1, int length1, Object *dict1);
virtual int getStart() { return start; }
- virtual GBool isOk() { return f != NULL; }
- virtual Dict *getDict() { return dict.getDict(); }
+ virtual void moveStart(int delta);
- private:
+private:
GBool fillBuf();
- GBool checkHeader();
FILE *f;
int start;
char *bufEnd;
int bufPos;
int savePos;
- Object dict;
};
//------------------------------------------------------------------------
-// SubStream
+// EmbedStream
+//
+// This is a special stream type used for embedded streams (inline
+// images). It reads directly from the base stream -- after the
+// EmbedStream is deleted, reads from the base stream will proceed where
+// the BaseStream left off. Note that this is very different behavior
+// that creating a new FileStream (using makeSubStream).
//------------------------------------------------------------------------
-class SubStream: public Stream {
+class EmbedStream: public BaseStream {
public:
- SubStream(Stream *str1, Object *dict1);
- virtual ~SubStream();
+ EmbedStream(Stream *str, Object *dict);
+ virtual ~EmbedStream();
+ virtual Stream *makeSubStream(int start, int length, Object *dict);
virtual StreamKind getKind() { return str->getKind(); }
virtual void reset() {}
virtual int getChar() { return str->getChar(); }
virtual int lookChar() { return str->lookChar(); }
virtual int getPos() { return str->getPos(); }
+ virtual void setPos(int pos);
virtual GBool isBinary(GBool last = gTrue) { return last; }
- virtual Stream *getBaseStream() { return this; }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return dict.getDict(); }
+ virtual int getStart();
+ virtual void moveStart(int delta);
private:
Stream *str;
- Object dict;
};
//------------------------------------------------------------------------
// ASCIIHexStream
//------------------------------------------------------------------------
-class ASCIIHexStream: public Stream {
+class ASCIIHexStream: public FilterStream {
public:
- ASCIIHexStream(Stream *str1);
+ ASCIIHexStream(Stream *str);
virtual ~ASCIIHexStream();
virtual StreamKind getKind() { return strASCIIHex; }
virtual void reset();
virtual int getChar()
{ int c = lookChar(); buf = EOF; return c; }
virtual int lookChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
private:
- Stream *str;
int buf;
GBool eof;
};
// ASCII85Stream
//------------------------------------------------------------------------
-class ASCII85Stream: public Stream {
+class ASCII85Stream: public FilterStream {
public:
- ASCII85Stream(Stream *str1);
+ ASCII85Stream(Stream *str);
virtual ~ASCII85Stream();
virtual StreamKind getKind() { return strASCII85; }
virtual void reset();
virtual int getChar()
{ int ch = lookChar(); ++index; return ch; }
virtual int lookChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
private:
- Stream *str;
int c[5];
int b[4];
int index, n;
// LZWStream
//------------------------------------------------------------------------
-class LZWStream: public Stream {
+class LZWStream: public FilterStream {
public:
- LZWStream(Stream *str1, int predictor1, int columns1, int colors1,
+ LZWStream(Stream *str, int predictor1, int columns1, int colors1,
int bits1, int early1);
virtual ~LZWStream();
virtual StreamKind getKind() { return strLZW; }
virtual int getChar();
virtual int lookChar();
virtual int getRawChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
private:
- Stream *str; // stream
StreamPredictor *pred; // predictor
int early; // early parameter
char zCmd[256]; // uncompress command
// RunLengthStream
//------------------------------------------------------------------------
-class RunLengthStream: public Stream {
+class RunLengthStream: public FilterStream {
public:
- RunLengthStream(Stream *str1);
+ RunLengthStream(Stream *str);
virtual ~RunLengthStream();
virtual StreamKind getKind() { return strRunLength; }
virtual void reset();
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
private:
- Stream *str;
char buf[128]; // buffer
char *bufPtr; // next char to read
char *bufEnd; // end of buffer
struct CCITTCodeTable;
-class CCITTFaxStream: public Stream {
+class CCITTFaxStream: public FilterStream {
public:
CCITTFaxStream(Stream *str, int encoding, GBool endOfLine,
virtual int getChar()
{ int c = lookChar(); buf = EOF; return c; }
virtual int lookChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
private:
- Stream *str; // stream
int encoding; // 'K' parameter
GBool endOfLine; // 'EndOfLine' parameter
GBool byteAlign; // 'EncodedByteAlign' parameter
Guchar sym[256]; // symbols
};
-class DCTStream: public Stream {
+class DCTStream: public FilterStream {
public:
- DCTStream(Stream *str1);
+ DCTStream(Stream *str);
virtual ~DCTStream();
virtual StreamKind getKind() { return strDCT; }
virtual void reset();
virtual int getChar();
virtual int lookChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
Stream *getRawStream() { return str; }
private:
- Stream *str; // stream
int width, height; // image size
int mcuWidth, mcuHeight; // size of min coding unit, in data units
DCTCompInfo compInfo[4]; // info for each component
int first; // first length/distance
};
-class FlateStream: public Stream {
+class FlateStream: public FilterStream {
public:
- FlateStream(Stream *str1, int predictor1, int columns1,
+ FlateStream(Stream *str, int predictor1, int columns1,
int colors1, int bits1);
virtual ~FlateStream();
virtual StreamKind getKind() { return strFlate; }
virtual int getChar();
virtual int lookChar();
virtual int getRawChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent);
virtual GBool isBinary(GBool last = gTrue);
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
private:
- Stream *str; // stream
StreamPredictor *pred; // predictor
Guchar buf[flateWindow]; // output data buffer
int index; // current index into output buffer
// EOFStream
//------------------------------------------------------------------------
-class EOFStream: public Stream {
+class EOFStream: public FilterStream {
public:
- EOFStream(Stream *str1);
+ EOFStream(Stream *str);
virtual ~EOFStream();
virtual StreamKind getKind() { return strWeird; }
virtual void reset() {}
virtual int getChar() { return EOF; }
virtual int lookChar() { return EOF; }
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
-
-private:
-
- Stream *str;
};
//------------------------------------------------------------------------
// FixedLengthEncoder
//------------------------------------------------------------------------
-class FixedLengthEncoder: public Stream {
+class FixedLengthEncoder: public FilterStream {
public:
- FixedLengthEncoder(Stream *str1, int length1);
+ FixedLengthEncoder(Stream *str, int length1);
~FixedLengthEncoder();
virtual StreamKind getKind() { return strWeird; }
virtual void reset();
virtual int getChar();
virtual int lookChar();
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
virtual GBool isEncoder() { return gTrue; }
private:
- Stream *str;
int length;
int count;
};
// ASCII85Encoder
//------------------------------------------------------------------------
-class ASCII85Encoder: public Stream {
+class ASCII85Encoder: public FilterStream {
public:
- ASCII85Encoder(Stream *str1);
+ ASCII85Encoder(Stream *str);
virtual ~ASCII85Encoder();
virtual StreamKind getKind() { return strWeird; }
virtual void reset();
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
virtual GBool isEncoder() { return gTrue; }
private:
- Stream *str;
char buf[8];
char *bufPtr;
char *bufEnd;
// RunLengthEncoder
//------------------------------------------------------------------------
-class RunLengthEncoder: public Stream {
+class RunLengthEncoder: public FilterStream {
public:
- RunLengthEncoder(Stream *str1);
+ RunLengthEncoder(Stream *str);
virtual ~RunLengthEncoder();
virtual StreamKind getKind() { return strWeird; }
virtual void reset();
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual int getPos() { return str->getPos(); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
- virtual Stream *getBaseStream() { return str->getBaseStream(); }
- virtual Stream *subStream (int start1, int length1, Object *dict1)
- { return str->subStream (start1, length1, dict1); }
- virtual int getStart() { return str->getStart(); }
- virtual GBool isOk() { return str->isOk(); }
- virtual Dict *getDict() { return str->getDict(); }
virtual GBool isEncoder() { return gTrue; }
private:
- Stream *str;
char buf[131];
char *bufPtr;
char *bufEnd;