Android InputStream to String Convert inputStream2String(InputStream is)

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

Description

input Stream String

Parameter

Parameter Description
is a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static String inputStream2String(InputStream is)
        throws IOException 

Method Source Code

//package com.java2s;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    /**/* w w w . j a v  a 2  s  . c  o  m*/
     * @param is
     * @return
     * @throws IOException
     */
    public static String inputStream2String(InputStream is)
            throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int i = -1;
        while ((i = is.read()) != -1) {
            baos.write(i);
        }
        return baos.toString();
    }
}

Related

  1. inputStream2String(InputStream in)
  2. stream2String(InputStream is, int maxLength)
  3. fromStream(InputStream stream)
  4. toConvertString(InputStream is)
  5. inStream2String(InputStream is)
  6. inStream2String(InputStream is)
  7. fromStream(InputStream inputStream)
  8. parseString(InputStream is)
  9. convertStreamToString(InputStream is)