Android InputStream to String Convert convertStreamToText(InputStream is)

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

Description

convert Stream To Text

License

Open Source License

Declaration

public static StringBuilder convertStreamToText(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 StringBuilder convertStreamToText(InputStream is) {
        String line = "";
        StringBuilder total = new StringBuilder();

        //wrap a BufferedReader around the input stream...
        BufferedReader rd = new BufferedReader(new InputStreamReader(is));

        //read response until the end...
        try {// ww w.  j  av  a 2s . c  o  m
            while ((line = rd.readLine()) != null) {
                total.append(line);
            }
        } catch (IOException e) {
        }

        //return full string
        return total;
    }
}

Related

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