Convert src/core/ccitt_stream.js
to use standard classes
This commit is contained in:
parent
8ff213871b
commit
0ca63f94b4
@ -17,9 +17,10 @@ import { Dict, isDict } from "./primitives.js";
|
||||
import { CCITTFaxDecoder } from "./ccitt.js";
|
||||
import { DecodeStream } from "./stream.js";
|
||||
|
||||
const CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
||||
// eslint-disable-next-line no-shadow
|
||||
function CCITTFaxStream(str, maybeLength, params) {
|
||||
class CCITTFaxStream extends DecodeStream {
|
||||
constructor(str, maybeLength, params) {
|
||||
super(maybeLength);
|
||||
|
||||
this.str = str;
|
||||
this.dict = str.dict;
|
||||
|
||||
@ -41,13 +42,9 @@ const CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
||||
EndOfBlock: params.get("EndOfBlock"),
|
||||
BlackIs1: params.get("BlackIs1"),
|
||||
});
|
||||
|
||||
DecodeStream.call(this, maybeLength);
|
||||
}
|
||||
|
||||
CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
|
||||
|
||||
CCITTFaxStream.prototype.readBlock = function () {
|
||||
readBlock() {
|
||||
while (!this.eof) {
|
||||
const c = this.ccittFaxDecoder.readNextChar();
|
||||
if (c === -1) {
|
||||
@ -57,9 +54,7 @@ const CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
||||
this.ensureBuffer(this.bufferLength + 1);
|
||||
this.buffer[this.bufferLength++] = c;
|
||||
}
|
||||
};
|
||||
|
||||
return CCITTFaxStream;
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
export { CCITTFaxStream };
|
||||
|
Loading…
Reference in New Issue
Block a user