Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to convert the images into the base64 encode and decode
We use the tJavaRow for encode base64 --->>
//Start
File file = new File("/home/user/logo.png");
byte[] bytes = loadFile(file);
String s = new sun.misc.BASE64Encoder().encode(bytes);
System.out.println(s);
//end
error Message:
Detail Message: File cannot be resolved to a type
Can you guide me further process
Go to your tJavaRow's Advanced Settings and add this line of code....
import java.io.File;
Program : tJavaRow
code:
File file = new File("/home/user/logo.png");
FileInputStream imageInFile = new FileInputStream(file);
byte imageData[] = new byte[(int)file.length()];
imageInFile.read(imageData);
//String imageDataString = encodeImage(imageData);
String imageStr = new sun.misc.BASE64Encoder().encode(imageData);
System.out.println("OKAy:"+imageStr);
imageInFile.close();
No error shown but we cannot get return any string value "System.out.println("OKAy:"+imageStr);"