Java InputStreamReader Read readFile(InputStream location)

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

Description

read File

License

Open Source License

Declaration

static String[] readFile(InputStream location) 

Method Source Code


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

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

import java.util.ArrayList;

public class Main {
    static String[] readFile(InputStream location) {
        ArrayList<String> readLines = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(new InputStreamReader(location))) {
            String line = br.readLine();
            while (line != null) {
                readLines.add(line);//  ww w. j  a v a  2 s. com
                line = br.readLine();
            }
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
        return readLines.toArray(new String[readLines.size()]);
    }
}

Related

  1. readFile(InputStream in)
  2. readFile(InputStream inputStream)
  3. readFile(InputStream inputStream)
  4. readFile(InputStream inputStream)
  5. readFile(InputStream is)
  6. readFile(InputStream stream, StringBuilder builder)
  7. readFile(Reader simpleReader)
  8. readFile(String aFile)
  9. readFile(String f)