Here you can find the source of readVersion(URLConnection connection)
private static String readVersion(URLConnection connection) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLConnection; public class Main { private static String readVersion(URLConnection connection) throws IOException { InputStreamReader reader = new InputStreamReader(connection.getInputStream()); BufferedReader stream = new BufferedReader(reader); String line = stream.readLine(); stream.close();// ww w .jav a 2 s . c om return line; } }