Java InputStreamReader Read readFile(InputStream in)

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

Description

read File

License

Open Source License

Declaration

public static String readFile(InputStream in) throws IOException 

Method Source Code


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

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

public class Main {
    public static String readFile(InputStream in) throws IOException {
        final StringBuffer sBuffer = new StringBuffer();
        final BufferedReader br = new BufferedReader(new InputStreamReader(in));
        final char[] buffer = new char[1024];

        int cnt;/*from  w ww  .j  a  va 2 s.co  m*/
        while ((cnt = br.read(buffer, 0, buffer.length)) > -1) {
            sBuffer.append(buffer, 0, cnt);
        }
        br.close();
        in.close();
        return sBuffer.toString();
    }
}

Related

  1. readFile(final String path)
  2. readFile(IFile file)
  3. readFile(IFile theFile)
  4. readFile(InputStream aStream)
  5. readFile(InputStream in)
  6. readFile(InputStream inputStream)
  7. readFile(InputStream inputStream)
  8. readFile(InputStream inputStream)
  9. readFile(InputStream is)