function constructor(stream) {
this.stream = stream;
this.dict = stream.dict;
- this.eof = true;
var cmf = stream.getByte();
var flg = stream.getByte();
if (cmf == -1 || flg == -1)
this.codeSize = 0;
this.codeBuf = 0;
this.pos = 0;
+ this.bufferPos = 0;
+ this.bufferLength = 0;
}
constructor.prototype = {
if (this.eof)
return;
this.readBlock();
- bufferPos = this.bufferPos;
}
return String.fromCharCode(this.buffer[bufferPos]);
},
check |= (b << 8);
if (check != (~this.blockLen & 0xffff))
error("Bad uncompressed block length in flate stream");
- var buffer = this.ensureBuffer(blockLen);
- this.bufferLength = blockLen;
- this.bufferPos = 0;
- for (var n = 0; n < blockLen; ++n) {
+ var bufferLength = this.bufferLength;
+ var buffer = this.ensureBuffer(bufferLength + blockLen);
+ this.bufferLength = bufferLength + blockLen;
+ for (var n = bufferLength; n < blockLen; ++n) {
if ((b = stream.getByte()) == -1) {
this.eof = true;
break;
error("Unknown block type in flate stream");
}
- var pos = 0;
+ var pos = this.bufferLength;
while (true) {
var code1 = this.getCode(litCodeTable);
if (code1 == 256) {
this.bufferLength = pos;
- this.bufferPos = 0;
+ //logBuffer(this.buffer, 0, pos);
+ //log(pos);
return;
}
if (code1 < 256) {