Android InputStream to String Convert convertStreamToString(InputStream is)

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

Description

convert Stream To String

License

Apache License

Declaration

public static String convertStreamToString(InputStream is)
            throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;

import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
    public static String convertStreamToString(InputStream is)
            throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();
        String line = null;/*from  www. ja  v  a 2 s.c o  m*/
        while ((line = reader.readLine()) != null) {
            sb.append(line).append("\n");
        }
        reader.close();
        return sb.toString();
    }
}

Related

  1. toStringBuffer(InputStream is)
  2. inputStreamToString(final InputStream is)
  3. convertStreamToString(InputStream is)
  4. convertStreamToString(InputStream is)
  5. convertStreamToString(InputStream is)
  6. convertStreamToText(InputStream is)
  7. convertStreamToText(InputStream is)
  8. convertToString(InputStream is, String encoding)
  9. convertToString(InputStream is, String encoding)