Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import android.util.Log; public class Main { private static final String I = "======================= [HELLO-WORLD] " + "Helper" + ": "; public static String arrayToString(String[] a) { StringBuffer result = new StringBuffer(); if (a.length > 0) { result.append(a[0]); for (int i = 1; i < a.length; i++) { result.append("; "); result.append(a[i]); } } return result.toString(); } /** * IMPORTANT: USE ONLY TEMPORARY!! DELETE THE FUNCTION AFTER DEBUGGING, * BECAUSE THE INPUTSTREAM WILL BE DESTROYED AFTER (WILL BE EMPTY) Writes * the content of the input stream to a <code>String<code>. */ public static String toString(InputStream inputStream) throws IOException { String string; StringBuilder outputBuilder = new StringBuilder(); try { if (inputStream != null) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); while (null != (string = reader.readLine())) { outputBuilder.append(string).append('\n'); } } } catch (Exception e) { Log.i(I, "Problem: toString(InputStream). Cannot convert."); } return outputBuilder.toString(); } }