Java URL Connection getStream(URL url)

Here you can find the source of getStream(URL url)

Description

get Stream

License

Open Source License

Declaration

public static Reader getStream(URL url) throws IOException 

Method Source Code

//package com.java2s;
/******************************************************************************
 * Copyright (c) 2002 - 2006 IBM Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://w w  w . j  a  v a2s.co  m
 *     IBM Corporation - initial API and implementation
 *****************************************************************************/

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

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

public class Main {
    public static Reader getStream(URL url) throws IOException {
        URLConnection conn = url.openConnection();
        conn.setDefaultUseCaches(false);
        conn.setUseCaches(false);

        return new InputStreamReader(conn.getInputStream());
    }
}

Related

  1. getRealURL(URL url)
  2. getRemoteTimestamp(final String url)
  3. getRequest(URLConnection conn)
  4. getRequestHeaders(URLConnection conn)
  5. getResultsWithEncoding(URLConnection source, String encoding)
  6. getStreamWithTimeOut(String stringUrl, Integer timeOutInMilli)
  7. getString(URL url)
  8. getType(URLConnection connection)
  9. getUrl(String serverName, String docid, String pageid)