Java InputStream Read All readAll(InputStream inputStream)

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

Description

read All

License

Open Source License

Declaration

public static String readAll(InputStream inputStream) throws IOException 

Method Source Code


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

import java.io.BufferedInputStream;

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

public class Main {
    public static String readAll(InputStream inputStream) throws IOException {
        StringBuilder result = new StringBuilder();
        BufferedInputStream buffered = new BufferedInputStream(inputStream);
        int i;/*  www  .  ja  v  a 2 s  .  c  o m*/
        while ((i = buffered.read()) != -1) {
            result.append((char) i);
        }
        return result.toString();
    }
}

Related

  1. readAll(InputStream in)
  2. readAll(InputStream in)
  3. readAll(InputStream in)
  4. readAll(InputStream in, byte[] buffer, int off, int len)
  5. readall(InputStream in, byte[] buffer, int offset, int len)
  6. readAll(InputStream is)
  7. readAll(InputStream is, byte[] buffer, int offset, int length)
  8. readAll(InputStream stream)
  9. readAll(InputStream stream)