Java InputStream to String inputStreamToStringBuffer(InputStream stream)

Here you can find the source of inputStreamToStringBuffer(InputStream stream)

Description

input Stream To String Buffer

License

Open Source License

Declaration

public static StringBuffer inputStreamToStringBuffer(InputStream stream) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static StringBuffer inputStreamToStringBuffer(InputStream stream) throws IOException {
        InputStreamReader reader = new InputStreamReader(stream);
        StringBuffer str = new StringBuffer();
        char[] buff = new char[8192];
        int len = 0;
        while ((len = reader.read(buff)) != -1) {
            str.append(buff, 0, len);/* w w  w.j a  v  a  2  s .co  m*/
        }
        reader.close();
        return str;
    }
}

Related

  1. inputStreamToString(InputStream is)
  2. inputStreamToString(InputStream is)
  3. inputStreamToString(InputStream s)
  4. inputStreamToString(InputStream stream)
  5. InputStreamToStringArray(InputStream input_stream)
  6. inputStreamToStringBuilder(final InputStream inputStream, final String charset)
  7. inputStreamToStringBuilder(InputStream in, int minimumCapacity)
  8. inputStreamToText(InputStream inputStream)
  9. loadText(InputStream in)