HI I read about the POI project and tried to extract images from thumbs.db, but I get an exception in the code .. Code os
InputStream stream = new FileInputStream("C:\\Thumbs.db");
POIFSFileSystem fs = new POIFSFileSystem(stream);
DirectoryEntry root = fs.getRoot();
Entry entry = root.getEntry("2");
DocumentInputStream is = fs.createDocumentInputStream(entry.getName());
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(is);
JPEGDecodeParam param = JPEGCodec.getDefaultJPEGEncodeParam(4, JPEGDecodeParam.COLOR_ID_RGBA);
decoder.setJPEGDecodeParam(param);
BufferedImage originalBufferedImage = decoder.decodeAsBufferedImage();
Getting an exception like "com.sun.image.codec.jpeg.ImageFormatException: not a jpeg file: starts at 0x0c 0x00"
What is the problem with the above case? Can you suggest another way to do the above tasks?
source
share