Java BufferedReader Read All readAllLines(InputStream inputStream)

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

Description

read All Lines

License

Apache License

Declaration

private static List<String> readAllLines(InputStream inputStream) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

import java.util.List;

public class Main {
    private static List<String> readAllLines(InputStream inputStream) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
        List<String> data = new ArrayList<>();
        for (String line; (line = br.readLine()) != null;) {
            data.add(line);/* ww  w .  ja  va  2s  .c  om*/
        }
        return data;
    }
}

Related

  1. readAllFromInputStream(InputStream inputStream)
  2. readAllFromInputStreamAsList(InputStream inputStream)
  3. ReadAllFromStream(InputStream source)
  4. readAllLines(File file)
  5. readAllLines(File file)
  6. readAllLines(InputStream is)
  7. readAllLines(String filepath)
  8. readAllStreamFromClasspathBaseResource(Class resourceBase, String dataLocation)
  9. readAllStreamsFromClasspathBaseResource(Class resourceBase, String[] dataLocations)