Here you can find the source of getInputStream(String url)
Parameter | Description |
---|---|
string | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
private static InputStream getInputStream(String url) throws IOException
//package com.java2s; /*// www . j ava 2s .c o m * #%L * Intuit Tank Api * %% * Copyright (C) 2011 - 2015 Intuit 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.eclipse.org/legal/epl-v10.html * #L% */ import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; public class Main { /** * @param string * @return * @throws IOException */ private static InputStream getInputStream(String url) throws IOException { HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("GET"); con.setConnectTimeout(3000); return con.getInputStream(); } }