@Override protected Image platformImageBytesToImage(byte[] bytes,long format) throws IOException {
  String mimeType=null;
  if (format == CF_PNG) {
    mimeType="image/png";
  }
 else   if (format == CF_JFIF) {
    mimeType="image/jpeg";
  }
  if (mimeType != null) {
    return standardImageBytesToImage(bytes,mimeType);
  }
  int[] imageData=platformImageBytesToImageData(bytes,format);
  if (imageData == null) {
    throw new IOException("data translation failed");
  }
  int len=imageData.length - 2;
  int width=imageData[len];
  int height=imageData[len + 1];
  DataBufferInt buffer=new DataBufferInt(imageData,len);
  WritableRaster raster=Raster.createPackedRaster(buffer,width,height,width,bandmasks,null);
  return new BufferedImage(directColorModel,raster,false,null);
}

@ Override protected Image platformImageBytesToImage ( byte [ ] bytes , long format ) throws IOException { String mimeType = null ; if ( format == CF_PNG ) { mimeType = "image/png" ; } else if ( format == CF_JFIF ) { mimeType = "image/jpeg" ; } if ( mimeType != null ) { return standardImageBytesToImage ( bytes , mimeType ) ; } int [ ] imageData = platformImageBytesToImageData ( bytes , format ) ; if ( imageData == null ) { throw new IOException ( "data translation failed" ) ; } int len = imageData . length - 2 ; int width = imageData [ len ] ; int height = imageData [ len + 1 ] ; DataBufferInt buffer = new DataBufferInt ( imageData , len ) ; WritableRaster raster = Raster . createPackedRaster ( buffer , width , height , width , bandmasks , null ) ; return new BufferedImage ( directColorModel , raster , false , null ) ; }
translates either a byte array or an input stream which contain platform - specific image data in the given format into an image .
