void decode() {
InputOutput io = IOProvider.getDefault().getIO(Bundle.CTL_Base64Encode(), false);
ImageUtil imageUtil = new ImageUtil();
try {
FileObject file = context.getPrimaryFile();
if (file.getExt().equalsIgnoreCase("ENCODE")) {
File newFile = new File(file.getPath());
String fileType = file.getName().substring(file.getName().lastIndexOf('.') + 1);
imageUtil.decodeToImage(FileUtils.readFileToString(newFile), file.getParent().getPath() + File.separator + file.getName(), fileType);
} else {
JOptionPane.showMessageDialog(null, "Invalid file to decode", "Warning", JOptionPane.WARNING_MESSAGE);
}
} catch (IOException ex) {
io.getOut().println("Exception: " + ex.toString());