I got this code to create and write a file from Oracle BLOB
to PNG
image file
try {
final File file = new File("C:/Users/John.Doe/Desktop/PDF Templates/POC/output/" + pdfObject.getFileName());
final FileWriter fileWriter = new FileWriter(file);
fileWriter.write(pdfObject.getContent()); << a String of the PNG content, see below:
fileWriter.flush();
fileWriter.close();
} catch (final IOException e) {
e.printStackTrace();
}
PNG File content:
�PNG
IHDR<binary code> .....
After i'm running this code, the image is not created well, means that, when i'm trying to open it using Microsoft Photos
it says: "It looks like we don't support this file format"
Also, the original file size is less then the new one that being created with the code above.
What i'm doing wrong here ?