I am working on a program that is essentially going to be a EXIF data stamper for exclusively JPEG images.

The GUI is going to consist of a search box a load button and a display box to display the EXIF data. But i am running into an issue with the reader:

public class MetaRead { public String readCustomData(byte[] imageData, String key) throws IOException{ ImageReader imageReader = ImageIO.getImageReadersByFormatName("JPEG").next(); imageReader.setInput(ImageIO.createImageInputStream(new ByteArrayInputStream(imageData)), true); // read metadata of first image IIOMetadata metadata = imageReader.getImageMetadata(0); //this cast helps getting the contents JPEGMetadata JPEGmeta = (JPEGMetadata) metadata; NodeList childNodes = JPEGmeta.getStandardTextNode().getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); String keyword = node.getAttributes().getNamedItem("keyword").getNodeValue(); String value = node.getAttributes().getNamedItem("value").getNodeValue(); if(key.equals(keyword)){ return value; } } return null; } }

I am getting an error at {JPEGMetadata JPEGmeta = (JPEGMetadata metadata;} "JPEGMetadata cannot be resolved to a type"

the original code was for a PNG so i replaced all PNG with JPEG with find/replace.