Android InputStream Read readInputStreamContent(InputStream inputStream)

Here you can find the source of readInputStreamContent(InputStream inputStream)

Description

read Input Stream Content

License

Open Source License

Declaration

public static String readInputStreamContent(InputStream inputStream)
            throws IOException 

Method Source Code

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

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

public class Main {
    public static String readInputStreamContent(InputStream inputStream)
            throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                inputStream));/*from w ww .  j a v a 2s.c o  m*/
        StringBuilder content = new StringBuilder();

        try {
            String line = reader.readLine();
            String separator = System.getProperty("line.separator");

            while (line != null) {
                content.append(line);
                content.append(separator);

                line = reader.readLine();
            }
        } finally {
            reader.close();
        }

        return content.toString();
    }
}

Related

  1. readFully(InputStream inputStream)
  2. readFullyAndClose(InputStream is)
  3. readInputStream(InputStream inStream)
  4. readInputStream(InputStream inputStream)
  5. readInputStream(InputStream is)
  6. readInt(InputStream stream)
  7. readLong(InputStream in, final int fitInBytes)
  8. readShort(InputStream stream)
  9. readStringFromInputStream(InputStream is)