title: Convert and display image from byte array
body: <p>I'm making a program, which gets data about an image in byte array from a server. I'm converting this data into 24bit BMP format (whether its jpeg, png, bmp or 8-24-32bpp). First, I'm saving it to my HD, and then I'm loading it into a JLabel's Icon. Works perfectly, though there are some cases in which I get the following exception:</p>
  
  <pre><code>java.io.EOFException at
  javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:353) at
  com.sun.imageio.plugins.bmp.BMPImageReader.read24Bit(BMPImageReader.java:1188) at
  com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:843) at
  javax.imageio.ImageIO.read(ImageIO.java:1448) at 
  javax.imageio.ImageIO.read(ImageIO.java:1308)
  </code></pre>
  
  <p>For this line (the second)</p>
  
  <pre><code>File imgFile = new File("d:/image.bmp");
  BufferedImage image = ImageIO.read(imgFile);
  </code></pre>
  
  <p>In these cases:</p>
  
  <ul>
  <li>the image does not load into the JLabel, but it can be found on my HD</li>
  <li>the conversion is not proper, because something "slips"</li>
  <li>the picture is like when you use italics in a word document</li>
  </ul>
  
  <p>First, i thought maybe the bpp is the problem, then i thought that maybe the pictures are too large, but i have cases it works and cases it doesn't for both suggestions. I'm a little stuck here, and would be glad for ideas.</p>