Android InputStream to String Convert inputStream2String(InputStream is)

Here you can find the source of inputStream2String(InputStream is)

Description

input Stream String

Declaration

public static String inputStream2String(InputStream is) 

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 String inputStream2String(InputStream is) {
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        StringBuffer buffer = new StringBuffer();
        String line = "";
        try {//from   ww  w . j a v a  2  s  . c o m
            while ((line = in.readLine()) != null) {
                buffer.append(line);
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return buffer.toString();
    }
}

Related

  1. convertInputStreamToString(InputStream inputStream)
  2. readStreamAsString(InputStream is)
  3. readStringFromStream(InputStream is)
  4. getString(InputStream is)
  5. inputStream2String(InputStream is)