• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

benrr101 / node-taglib-sharp / 47556045

pending completion
47556045

push

appveyor

Ben Russell
fixing-missing-settings

3255 of 4223 branches covered (77.08%)

Branch coverage included in aggregate %.

26553 of 28216 relevant lines covered (94.11%)

412.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/src/mpeg4/descriptorTagReader.ts
1
import { NumberUtils } from "../utils";
1✔
2
import { ByteVector } from "../byteVector";
3

4
/**
5
 * Provides methods to read descriptor tags
6
 */
7
export class DescriptorTagReader {
1✔
8
    private _length: number = 0;
×
9
    private _offset: number = 0;
×
10

11
    public constructor(private data: ByteVector) { }
×
12

13
    public get length(): number {
14
        return this._length;
×
15
    }
16

17
    public get offset(): number {
18
        return this._offset;
×
19
    }
20

21
    /**
22
     * Reads a section length and updates the offset to the end of of the length block.
23
     * @param data A @see ByteVector object to read from.
24
     * @param offset A value reference specifying the offset at which to read. This value gets updated to the
25
     * position following the size data.
26
     * @returns A value containing the length that was read.
27
     */
28
    public readLength(): number {
29
        let b: number = 0;
×
30
        const end: number = this._offset + 4;
×
31

32
        do {
×
33
            b = this.data.get(this._offset++);
×
34
            this._length = NumberUtils.uintOr(NumberUtils.uintLShift(this._length, 7), NumberUtils.uintAnd(b, 0x7f));
×
35
        } while (NumberUtils.uintAnd(b, 0x80) !== 0 && this._offset <= end); // The length could be between 1 and 4 bytes for each descriptor
×
36

37
        return this._length;
×
38
    }
39

40
    /**
41
     * Increases the current offset by a given value
42
     * @param value A number by which the offset should be increased
43
     * @returns A value containing the offset before increase
44
     */
45
    public increaseOffset(value: number): number {
46
        const previousOffset: number = this._offset;
×
47
        this._offset += value;
×
48

49
        return previousOffset;
×
50
    }
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc