How should I call a large URL in Java? I'm integrating scene7 image server with java application. Here I call a URL of around 10000 characters which should return me an Image. What ways can I do this?
The way I wrote is -
URL oURL= new URL("<*LONG LONG URL - approx. 10k characters*>");
HttpURLConnection connection = (HttpURLConnection) oURL.openConnection();
InputStream stream = connection.getInputStream();
int len;
byte[] buf = new byte[1024];
BufferedImage bi = ImageIO.read(stream);
ImageIO.write(bi,"png",response.getOutputStream());
while ((len = stream.read(buf)) > 0) {
outs.write(buf, 0, len);
}