26 throws IOException, URISyntaxException {
27 URL url =
new URI(imageUrl).toURL();
28 try (InputStream in = url.openStream();
29 ByteArrayOutputStream out =
new ByteArrayOutputStream()) {
30 byte[] buffer =
new byte[1024];
32 while ((bytesRead = in.read(buffer)) != -1) {
33 out.write(buffer, 0, bytesRead);
35 return out.toByteArray();