-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
I'm trying to simulate it with a image from my pc (so I know it is a valid image)
File file = new File("C://AceptarNuevo.png");
int ch;
StringBuffer strContent = new StringBuffer("");
FileInputStream fin = null;
String fichero = "";
try{
fin = new FileInputStream(file);
while( (ch = fin.read()) != -1)
strContent.append((char)ch);
fin.close();
}catch(FileNotFoundException e){
System.out.println("El fichero " + file.getAbsolutePath() + " no se encuentra en el sistema");
}catch(IOException ioe){
System.out.println("Exception leyendo el fichero" + ioe);
}
fichero = strContent.toString(); //I do this to simulate the String I recive from DB
AImage aimagen = null;
try {
aimagen = new AImage("",fichero.getBytes());
img.setContent(aimagen);
} catch (IOException e) {
System.err.println(e.getCause());
// TODO Auto-generated catch block
e.printStackTrace();
}
With this code I get the java.io.Exception that I described above