Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import android.util.Log; public class Main { private static final String TAG = "SuperUtil"; public static String getDefaultCurrencies(InputStream is) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; try { Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); } } catch (UnsupportedEncodingException e) { Log.e(TAG, "loadCurrencies " + "Encoding error"); } catch (IOException e) { Log.e(TAG, "loadCurrencies " + "IOException"); } finally { try { is.close(); } catch (IOException e) { Log.e(TAG, "loadCurrencies " + "IOException - close"); } } return writer.toString(); } }