Java BufferedReader Read All readAllLines(InputStream is)

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

Description

read All Lines

License

Open Source License

Declaration

public static List<String> readAllLines(InputStream is) 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;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> readAllLines(InputStream is) throws IOException {
        List<String> ls = new ArrayList<String>();
        BufferedReader buffer = new BufferedReader(new InputStreamReader(is));

        String line;// w  w w .j a  va2 s  . c  o m
        while ((line = buffer.readLine()) != null) {
            ls.add(line);
        }

        return ls;
    }
}

Related

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