Java InputStream to String inputStream2String(InputStream is)

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

Description

input Stream String

License

Open Source License

Declaration

public static String inputStream2String(InputStream is) 

Method Source Code

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

import java.io.ByteArrayOutputStream;

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

public class Main {
    public static String inputStream2String(InputStream is) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int i = -1;
        try {//from  w ww.j  a v a 2  s  .  c  o m
            while ((i = is.read()) != -1) {
                baos.write(i);
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return baos.toString();
    }
}

Related

  1. InputStream2String(InputStream in, String encoding)
  2. InputStream2String(InputStream in_st, String charset)
  3. inputStream2String(InputStream inputstream)
  4. inputStream2String(InputStream inStream)
  5. inputStream2String(InputStream is)
  6. inputStream2String(InputStream is)
  7. inputStream2String(InputStream is)
  8. inputStream2String(InputStream source)
  9. inputstream_to_string(InputStream in)