import java.util.zip.GZIPInputStream
String pageUrl = "http://www.google.com"
BufferedInputStream buff = pageUrl.toURL().newInputStream(requestProperties: ['Accept-Encoding': 'gzip,deflate'])
BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(buff)))
String resp = ""; reader.eachLine{ line -> resp += line }
No comments:
Post a Comment