Android InputStream to String Convert convertInputStreamToString(InputStream inputStream)

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

Description

convert Input Stream To String

Declaration

private static String convertInputStreamToString(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 {
    private static String convertInputStreamToString(InputStream inputStream)
            throws IOException {
        BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(inputStream));
        String line = "";
        String result = "";
        while ((line = bufferedReader.readLine()) != null) {
            result += line;//from   w  w  w  .  ja v  a2 s . c  o  m
        }

        inputStream.close();
        return result;

    }
}

Related

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