Skip to content

Commit

Permalink
Implement NullStream, fix mozilla#1832
Browse files Browse the repository at this point in the history
  • Loading branch information
saebekassebil committed Oct 22, 2012
1 parent ece9cd1 commit 58d6974
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ var Parser = (function ParserClosure() {
return stream;
},
makeFilter: function Parser_makeFilter(stream, name, length, params) {
if (stream.dict.get('Length') === 0) {
return new NullStream(stream);
}
if (name == 'FlateDecode' || name == 'Fl') {
if (params) {
return new PredictorStream(new FlateStream(stream), params);
Expand Down
9 changes: 9 additions & 0 deletions src/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2350,3 +2350,12 @@ var LZWStream = (function LZWStreamClosure() {
return LZWStream;
})();

var NullStream = (function NullStreamClosure() {
function NullStream() {
Stream.call(this, new Uint8Array(0));
}

NullStream.prototype = Stream.prototype;

return NullStream;
})();

0 comments on commit 58d6974

Please sign in to comment.