Java URL Read readUrl(final String url_str)

Here you can find the source of readUrl(final String url_str)

Description

read Url

License

Open Source License

Declaration

public static List<String> readUrl(final String url_str)
            throws IOException 

Method Source Code

//package com.java2s;
// License as published by the Free Software Foundation; either

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.URL;
import java.net.URLConnection;

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> readUrl(final String url_str)
            throws IOException {
        final URL url = new URL(url_str);
        final URLConnection urlc = url.openConnection();
        //urlc.setRequestProperty( "User-Agent", "" );
        final BufferedReader in = new BufferedReader(new InputStreamReader(
                urlc.getInputStream()));
        String line;//from  w w  w.  ja  va 2  s . c o  m
        final List<String> result = new ArrayList<String>();
        while ((line = in.readLine()) != null) {
            result.add(line);
        }
        in.close();
        return result;
    }
}

Related

  1. readListFromURL(URL p_url)
  2. readPage(String url)
  3. readStringFromURL(String sourceURL)
  4. readUrl(final String strUrl)
  5. readUrl(final String url)
  6. readURL(String path)
  7. readUrl(String url_str)
  8. readUrl(String urlString)
  9. readURL(URL url)