Android InputStream to String Convert toStringBuffer(InputStream is)

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

Description

to String Buffer

Declaration

public static StringBuilder toStringBuffer(InputStream is)
        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 StringBuilder toStringBuffer(InputStream is)
            throws IOException {
        if (null == is)
            return null;
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        StringBuilder buffer = new StringBuilder();
        String line = null;//from w  ww .java2  s .  c o m
        while ((line = in.readLine()) != null) {
            buffer.append(line).append("\n");
        }
        is.close();
        return buffer;
    }
}

Related

  1. toString(InputStream is)
  2. toString(InputStream is)
  3. toString(InputStream is)
  4. toStringBuffer(InputStream is)
  5. toStringBuffer(InputStream is)
  6. inputStreamToString(final InputStream is)
  7. convertStreamToString(InputStream is)
  8. convertStreamToString(InputStream is)
  9. convertStreamToString(InputStream is)