All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thelastcheck.io.x9.utils.X937ImageViewDataRecordImageOffset Maven / Gradle / Ivy

There is a newer version: 2.5.3
Show newest version
package com.thelastcheck.io.x9.utils;

import com.thelastcheck.commons.base.exception.InvalidDataException;
import com.thelastcheck.io.x937.records.X937ImageViewDataRecord;


public class X937ImageViewDataRecordImageOffset {

    private final X937ImageViewDataRecord record;

    public X937ImageViewDataRecordImageOffset(X937ImageViewDataRecord record) {
        this.record = record;
    }

    public long offset() {
        return offset(record);
    }

    public static long offset(X937ImageViewDataRecord record) {
        long offset = record.offsetPosition() + 4; // starting position plus prefix
        offset += record.length();
        try {
            offset -= record.lengthOfImageDataAsInt();
        } catch (InvalidDataException e) {
            throw new RuntimeException(e);
        }
        return offset;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy