I have an image url (http://example.com/myimage.jpg) and want to convert it to byte array and save it in my DB.
I did the following, but getting this message URI scheme is not "file"
URI uri = new URI(profileImgUrl);
File fnew = new File(uri);
BufferedImage originalImage=ImageIO.read(fnew);
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ImageIO.write(originalImage, "jpg", baos );
byte[] imageInByte=baos.toByteArray();