all files / core/compression/ pdf-fax-stream.js

58.33% Statements 21/36
64.71% Branches 11/17
72.73% Functions 8/11
54.55% Lines 18/33
11 statements, 6 functions, 9 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57                                                                             
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "../decode-stream", "../graphics/images/pdf-fax-decoder", "../pdf-primitives"], function (require, exports, decode_stream_1, pdf_fax_decoder_1, pdf_primitives_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var _PdfFaxStream = (function (_super) {
        __extends(_PdfFaxStream, _super);
        function _PdfFaxStream(str, maybeLength, params) {
            var _this = _super.call(this, maybeLength) || this;
            _this.stream = str;
            if (!(params instanceof pdf_primitives_1._PdfDictionary)) {
                params = new pdf_primitives_1._PdfDictionary(null);
            }
            var source = {
                next: function () {
                    return str.getByte();
                }
            };
            _this.ccittFaxDecoder = new pdf_fax_decoder_1._PdfFaxDecoder(source, {
                K: params.get('K'),
                EndOfLine: params.get('EndOfLine'),
                EncodedByteAlign: params.get('EncodedByteAlign'),
                Columns: params.get('Columns'),
                Rows: params.get('Rows'),
                EndOfBlock: params.get('EndOfBlock'),
                BlackIs1: params.get('BlackIs1')
            });
            return _this;
        }
        _PdfFaxStream.prototype.readBlock = function () {
            while (!this.eof) {
                var c = this.ccittFaxDecoder.readNextChar();
                if (c === -1) {
                    this.eof = true;
                    return;
                }
                this.ensureBuffer(this.bufferLength + 1);
                this.buffer[this.bufferLength++] = c;
            }
        };
        return _PdfFaxStream;
    }(decode_stream_1._PdfDecodeStream));
    exports._PdfFaxStream = _PdfFaxStream;
});