Java InputStream to String InputStream2String(InputStream in_st, String charset)

Here you can find the source of InputStream2String(InputStream in_st, String charset)

Description

Input Stream String

License

Open Source License

Declaration

public static String InputStream2String(InputStream in_st, String charset) 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 String InputStream2String(InputStream in_st, String charset) throws IOException {
        BufferedReader buff = new BufferedReader(new InputStreamReader(in_st, charset));
        StringBuffer res = new StringBuffer();
        String line = "";
        while ((line = buff.readLine()) != null) {
            res.append(line);/* w  w w . ja v  a2s .  co m*/
        }
        return res.toString();
    }
}

Related

  1. getStreamContents(final InputStream is)
  2. inputStream2String(InputStream in)
  3. inputStream2String(InputStream in)
  4. inputStream2String(InputStream in)
  5. InputStream2String(InputStream in, String encoding)
  6. inputStream2String(InputStream inputstream)
  7. inputStream2String(InputStream inStream)
  8. inputStream2String(InputStream is)
  9. inputStream2String(InputStream is)