Android InputStream to String Convert fromStream(InputStream inputStream)

Here you can find the source of fromStream(InputStream inputStream)

Description

from Stream

License

Open Source License

Declaration

public static String fromStream(InputStream inputStream)
            throws IOException 

Method Source Code

//License from project: Open Source License 

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main{
    private static final int BUFFER_SIZE = 4096;
    public static String fromStream(InputStream inputStream)
            throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                inputStream), BUFFER_SIZE);
        StringBuilder stringBuilder = new StringBuilder();
        String line;//from w ww.  j  a v  a2 s  .c  om
        try {
            while ((line = reader.readLine()) != null) {
                ALog.i(line);
                stringBuilder.append(line);
            }
        } finally {
            inputStream.close();
        }
        return stringBuilder.toString();
    }
}

Related

  1. fromStream(InputStream stream)
  2. toConvertString(InputStream is)
  3. inStream2String(InputStream is)
  4. inputStream2String(InputStream is)
  5. inStream2String(InputStream is)
  6. parseString(InputStream is)
  7. convertStreamToString(InputStream is)
  8. readToString(final InputStream inputStream)
  9. inputStreamToString(InputStream inputstream)