Android InputStream to String Convert inputStreamToString(InputStream in)

Here you can find the source of inputStreamToString(InputStream in)

Description

input Stream To String

License

Open Source License

Declaration

public static String inputStreamToString(InputStream in)
            throws IOException 

Method Source Code

//package com.java2s;
/*//from  w ww .j  a  v a  2 s  . c  om
 * Copyright (C) 2012 mods.de community 
 *
 * Everyone is permitted to copy and distribute verbatim or modified
 * copies of this software, and changing it is allowed as long as the 
 * name is changed.
 *
 *           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
 *  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 *
 *  0. You just DO WHAT THE FUCK YOU WANT TO. 
 */

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

public class Main {
    public static String inputStreamToString(InputStream in)
            throws IOException {
        BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(in));
        StringBuilder stringBuilder = new StringBuilder();
        String line = null;

        while ((line = bufferedReader.readLine()) != null) {
            stringBuilder.append(line + "\n");
        }

        bufferedReader.close();
        return stringBuilder.toString();
    }
}

Related

  1. convert(InputStream is)
  2. readInputStream(InputStream inStream)
  3. toString(InputStream is)
  4. toStringBuffer(InputStream is)
  5. inputStream2String(InputStream in)
  6. inputStreamToString(InputStream is)
  7. InputStreamToString(InputStream stream)
  8. convertInputStreamToString(InputStream inputStream)
  9. convertStreamToString(InputStream inputStream)