Java

/* The method "openStream()" is the responsible of opening a connection with the URL and returning a result to read.*/privateStringreadURL(URLurl)throwsIOException{ByteArrayOutputStreambaos=newByteArrayOutputStream();InputStreamis=null;try{is=url.openStream();}catch(Exceptione){e.printStackTrace();}intr;while((r=is.read())!=-1){baos.write(r);}returnnewString(baos.toByteArray());}