Java InputStreamReader Read readFile(InputStream stream, StringBuilder builder)

Here you can find the source of readFile(InputStream stream, StringBuilder builder)

Description

read File

License

Open Source License

Declaration

private static void readFile(InputStream stream, StringBuilder builder) 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 {
    private static void readFile(InputStream stream, StringBuilder builder) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(stream));
        String s = "";
        try {/*from   ww  w.j av a  2 s  . c  o m*/
            while ((s = br.readLine()) != null) {
                builder.append(s + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            br.close();
            stream.close();
        }
    }
}

Related

  1. readFile(InputStream inputStream)
  2. readFile(InputStream inputStream)
  3. readFile(InputStream inputStream)
  4. readFile(InputStream is)
  5. readFile(InputStream location)
  6. readFile(Reader simpleReader)
  7. readFile(String aFile)
  8. readFile(String f)
  9. readFile(String f, String delim)