Java URLConnection Create openInputStream(URL url)

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

Description

open Input Stream

License

Open Source License

Declaration

static InputStream openInputStream(URL url) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

public class Main {
    static InputStream openInputStream(URL url) throws IOException {
        URLConnection uRLConnection = url.openConnection();
        uRLConnection.setRequestProperty("User-Agent",
                "Valve/Steam HTTP Client 1.0 (tenfoot)");
        uRLConnection.setRequestProperty("Cookie",
                "birthtime=-3599; lastagecheckage=1-January-1970");
        uRLConnection.setConnectTimeout(8000);
        uRLConnection.setReadTimeout(8000);
        return uRLConnection.getInputStream();
    }//from  ww  w  .j  av a 2s.  c o  m
}

Related

  1. openConnection(URL url)
  2. openConnection(URL url)
  3. openConnection(URL url)
  4. openConnectionForceNoProxy(URL url)
  5. openConnectionTo(URL descriptor)
  6. openURL(String url)
  7. openURLStream(final URI uri)