I got a problem, I can't display an image from my Database in GWT, even when I proved and I could save the image in my computer. Here is the code:
        byte[] bytes = new byte[8096];
        int len = 0;
        while ( (len = in.read( bytes ))> 0 )
        {
         开发者_开发知识库   if(!fichero.exists())
            {
                out.write( bytes, 0, len );
            }
        }
        out.flush();
        out.close();
        in.close();
        //byte[] bytes = IOUtils.toByteArray(in);
        String base64 = Base64Utils.toBase64(bytes); 
        //base64 = "data:image/png;base64,"+base64;
        base64 = "data:image/gif;base64,"+base64;
        return base64;
        }
        else
        {
            return "http://cracktouch.com/wp-content/uploads/2011/02/Run-Like-Hell-Deluxe.png";
        }
This code is in the class GreetingServiceImpl. "in" is an Inputstream with the image which is correct because I could save the image in my computer, but I can't display it in GWT when I use the string base64 like this: Image image = new Image(base64); contenido.add(image); Any suggestion?
The bytes array is fixed size and is bigger then the image data - so there are some unused 0s at the end.
Call to Base64Utils.toBase64(bytes) converts the whole array including unused data to string.
Either trim the array or use a Base64 implementation where you can specify size of input data.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论