Java URL Connection getAsStream(URL url)

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

Description

get As Stream

License

Open Source License

Declaration

protected static InputStream getAsStream(URL url) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2006, 2007 Bug Labs, Inc..
 * 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.buglabs.net/legal/epl_license.html
 *******************************************************************************/

import java.io.IOException;
import java.io.InputStream;

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

public class Main {
    protected static InputStream getAsStream(URL url) throws IOException {
        URLConnection conn = url.openConnection();

        conn.setDoInput(true);/*from  ww  w  .j  av  a2 s.co m*/
        conn.setDoOutput(false);

        return conn.getInputStream();
    }
}

Related

  1. doPost(final URL url, final Map parameters, final boolean encode)
  2. doPost(String url, String params, String charset)
  3. findClasses(URL resource, String packageName, boolean annotated)
  4. findClasspathUrls(ClassLoader classLoader)
  5. findResourceInJarPackage(URL url, String packageName, String packageDirName, boolean recursive, List resources)
  6. getBaseAuthInputStreamFromURL(String query, String basicAuthString)
  7. getBaseURL(URLConnection conn)
  8. getBooleanFromUrl(String url)
  9. getBytes(String urlStr)