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