Convert src/core/run_length_stream.js
to use standard classes
This commit is contained in:
parent
66b898eb58
commit
704514c7cd
@ -15,18 +15,15 @@
|
|||||||
|
|
||||||
import { DecodeStream } from "./stream.js";
|
import { DecodeStream } from "./stream.js";
|
||||||
|
|
||||||
const RunLengthStream = (function RunLengthStreamClosure() {
|
class RunLengthStream extends DecodeStream {
|
||||||
// eslint-disable-next-line no-shadow
|
constructor(str, maybeLength) {
|
||||||
function RunLengthStream(str, maybeLength) {
|
super(maybeLength);
|
||||||
|
|
||||||
this.str = str;
|
this.str = str;
|
||||||
this.dict = str.dict;
|
this.dict = str.dict;
|
||||||
|
|
||||||
DecodeStream.call(this, maybeLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunLengthStream.prototype = Object.create(DecodeStream.prototype);
|
readBlock() {
|
||||||
|
|
||||||
RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
|
|
||||||
// The repeatHeader has following format. The first byte defines type of run
|
// The repeatHeader has following format. The first byte defines type of run
|
||||||
// and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes
|
// and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes
|
||||||
// (in addition to the second byte from the header), n = 129 through 255 -
|
// (in addition to the second byte from the header), n = 129 through 255 -
|
||||||
@ -58,9 +55,7 @@ const RunLengthStream = (function RunLengthStreamClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.bufferLength = bufferLength;
|
this.bufferLength = bufferLength;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
return RunLengthStream;
|
|
||||||
})();
|
|
||||||
|
|
||||||
export { RunLengthStream };
|
export { RunLengthStream };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user