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

com.github.cosycode.bdmp.BdmpRecInfo Maven / Gradle / Ivy

Go to download

a way to transfer data in the form of dot-matrix information in pictures(比特数据图片, 一种以图片信息的形式传递数据的方式)

There is a newer version: 1.4
Show newest version
package com.github.cosycode.bdmp;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * Description :  用于存放像素图片识别后的信息
 *
 * @author CPF
 * @date 2020/11/10
 **/
@Data
@Slf4j
public class BdmpRecInfo {

    private BdmpHeader bdmpHeader;

    private int[] byteModal;
    /**
     * x 像素区域列表
     */
    private int[] xArr;

    /**
     * y 像素区域列表
     */
    private int[] yArr;

    private byte[] fileContent;

    private int pixelTypeCnt;

    private int bitCnt;

    private int contentLength;

    /**
     * 检查文件MD5值
     */
    public boolean check() {
        String md5Hex = BdmpUtils.encrypt2ToMd5(fileContent);
        String md5 = bdmpHeader.getContentMd5();
        log.info("像素head信息MD5值: {}", md5);
        log.info("文件解析内容MD5值: {}", md5);
        return md5.equalsIgnoreCase(md5Hex);
    }

    @Override
    public String toString() {
        return "BdmpRecInfo{" +
                "bdmpHeader=" + bdmpHeader +
                ", pixelTypeCnt=" + pixelTypeCnt +
                ", bitCnt=" + bitCnt +
                ", contentLength=" + contentLength +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy