com.mcgath.jhove.module.png.PlteChunk Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jhove-modules Show documentation
Show all versions of jhove-modules Show documentation
The JHOVE HUL validation modules.
package com.mcgath.jhove.module.png;
import edu.harvard.hul.ois.jhove.ErrorMessage;
import edu.harvard.hul.ois.jhove.RepInfo;
/** Representation of the PLTE chunk
*/
public class PlteChunk extends PNGChunk {
/** Constructor */
public PlteChunk(int sig, long leng) {
chunkType = sig;
length = leng;
ancillary = false;
}
public void processChunk(RepInfo info) throws Exception {
ErrorMessage msg = null;
processChunkCommon(info);
if (_module.isPlteSeen()) {
msg = new ErrorMessage ("Multiple PLTE chunks are not allowed");
}
_module.setPlteSeen(true);
if (_module.isIdatSeen()) {
msg = new ErrorMessage("PLTE chunk is not allowed after first IDAT chunk");
}
if ((length % 3) != 0) {
// must be a multiple of 3 bytes
msg = new ErrorMessage("Invalid PLTE chunk length " + length);
}
if (msg != null) {
info.setMessage(msg);
info.setWellFormed(false);
throw new PNGException ("PLTE chunk error");
}
for (int i = 0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy