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 { CCITTFaxDecoder } from "./ccitt.js";
|
||||||
import { DecodeStream } from "./stream.js";
|
import { DecodeStream } from "./stream.js";
|
||||||
|
|
||||||
const CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
class CCITTFaxStream extends DecodeStream {
|
||||||
// eslint-disable-next-line no-shadow
|
constructor(str, maybeLength, params) {
|
||||||
function CCITTFaxStream(str, maybeLength, params) {
|
super(maybeLength);
|
||||||
|
|
||||||
this.str = str;
|
this.str = str;
|
||||||
this.dict = str.dict;
|
this.dict = str.dict;
|
||||||
|
|
||||||
@ -41,13 +42,9 @@ const CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
EndOfBlock: params.get("EndOfBlock"),
|
EndOfBlock: params.get("EndOfBlock"),
|
||||||
BlackIs1: params.get("BlackIs1"),
|
BlackIs1: params.get("BlackIs1"),
|
||||||
});
|
});
|
||||||
|
|
||||||
DecodeStream.call(this, maybeLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
|
readBlock() {
|
||||||
|
|
||||||
CCITTFaxStream.prototype.readBlock = function () {
|
|
||||||
while (!this.eof) {
|
while (!this.eof) {
|
||||||
const c = this.ccittFaxDecoder.readNextChar();
|
const c = this.ccittFaxDecoder.readNextChar();
|
||||||
if (c === -1) {
|
if (c === -1) {
|
||||||
@ -57,9 +54,7 @@ const CCITTFaxStream = (function CCITTFaxStreamClosure() {
|
|||||||
this.ensureBuffer(this.bufferLength + 1);
|
this.ensureBuffer(this.bufferLength + 1);
|
||||||
this.buffer[this.bufferLength++] = c;
|
this.buffer[this.bufferLength++] = c;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
return CCITTFaxStream;
|
|
||||||
})();
|
|
||||||
|
|
||||||
export { CCITTFaxStream };
|
export { CCITTFaxStream };
|
||||||
|
Loading…
Reference in New Issue
Block a user