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

com.mcgath.jhove.module.png.ZtxtChunk Maven / Gradle / Ivy

There is a newer version: 1.20.1
Show newest version
package com.mcgath.jhove.module.png;

import java.util.zip.DataFormatException;

import edu.harvard.hul.ois.jhove.ErrorMessage;
import edu.harvard.hul.ois.jhove.RepInfo;

/** Representation of the zTXt (compressed text) chunk */
public class ZtxtChunk extends GeneralTextChunk {

	/** Constructor */
	public ZtxtChunk(int sig, long leng) {
		chunkType = sig;
		length = leng;
		ancillary = true;
		duplicateAllowed = true;
	}
	
	public void processChunk(RepInfo info) throws Exception {
		final String badchunk = "Bad zTXt chunk";
		processChunkCommon(info);
		
		// The tEXt chunk consists of a keyword, a null, a compression type,
		// and a value.
		// There needs to be exactly one null in the data.
		StringBuilder sb = new StringBuilder();
		String keyword = null;
		String value = null;
		ErrorMessage msg;
		int cmprsIdx = 0;
		// State values: 0 = keyword, 1 = compression type, 2 = compressed data
		int state = 0;
		byte[] compressedData = new byte[(int) length];
		for (int i = 0; i 




© 2015 - 2025 Weber Informatics LLC | Privacy Policy