2
0
mirror of https://github.com/gchq/CyberChef synced 2025-12-10 21:33:36 +00:00

Completed GZIP extraction

This commit is contained in:
n1474335
2019-01-11 17:44:13 +00:00
parent c077b22410
commit 4e57b4be88
3 changed files with 222 additions and 23 deletions

View File

@@ -90,7 +90,6 @@ export default class Stream {
return val;
}
/**
* Reads a number of bits from the buffer.
*
@@ -194,7 +193,6 @@ export default class Stream {
this.bitPos = 0;
}
/**
* Move backwards through the stream by the specified number of bytes.
*
@@ -208,6 +206,29 @@ export default class Stream {
this.bitPos = 0;
}
/**
* Move backwards through the strem by the specified number of bits.
*
* @param {number} numBits
*/
moveBackwardsByBits(numBits) {
if (numBits <= this.bitPos) {
this.bitPos -= numBits;
} else {
if (this.bitPos > 0) {
numBits -= this.bitPos;
this.bitPos = 0;
}
while (numBits > 0) {
this.moveBackwardsBy(1);
this.bitPos = 8;
this.moveBackwardsByBits(numBits);
numBits -= 8;
}
}
}
/**
* Move to a specified position in the stream.
*