Code example for Closeable

Methods: close

0
	} 
 
	public static void closeStream(Closeable stream) {
		if (stream != null) {
			try { 
				stream.close();
				stream = null;
			} catch (IOException e) {
				Log.w(TAG, "Close stream exception", e);
			} 
		} 
	} 
 
	public static InputStream getInputStreamFromUrl(String url)
			throws ClientProtocolException, IOException { 
		HttpGet request = new HttpGet(url);
		DefaultHttpClient client = new DefaultHttpClient(getTimeoutHttpParams());
		HttpResponse response = client.execute(request);
		int statusCode = response.getStatusLine().getStatusCode();
		if (statusCode != 200) {
			Log.e(TAG, "Failed to get stream for: " + url);