Java URL Read readVersion(URLConnection connection)

Here you can find the source of readVersion(URLConnection connection)

Description

read Version

License

Apache License

Declaration

private static String readVersion(URLConnection connection) throws IOException 

Method Source Code


//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;
    }
}

Related

  1. readUrl(URL url, String[]... headers)
  2. readURL(URLConnection connection, String charset)
  3. readUrlContent(URLConnection connection)
  4. readURLToString(String url)
  5. readUrlToString(String urlString)
  6. retrieve(URL url)
  7. retrieveResponseMessage(HttpURLConnection connection)