Android InputStream to String Convert inputStreamToString(InputStream inputStream)

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

Description

input Stream To String

Declaration

public static String inputStreamToString(InputStream inputStream)
            throws IOException 

Method Source Code

//package com.java2s;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
    public static final int BUFFER_SIZE = 8192;

    public static String inputStreamToString(InputStream inputStream)
            throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(
                inputStream), BUFFER_SIZE);
        StringBuffer buffer = new StringBuffer();
        String line = "";
        while ((line = in.readLine()) != null) {
            buffer.append(line);/*from   w  w  w.j  a  v a 2  s  .  co  m*/
        }
        return buffer.toString();
    }
}

Related

  1. inputStreamToString(InputStream stream)
  2. streamToString(InputStream in, String charset)
  3. InputStreamToString(InputStream in)
  4. inputToString(InputStream inputStream, String encoding)
  5. converStreamToString(InputStream is)
  6. streamToString(InputStream is)
  7. slurp(InputStream in)
  8. convertStreamToString(InputStream is)
  9. inStream2Str(InputStream inputStream, String encode)