Java InputStream to Text Line toLines(InputStream is)

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

Description

to Lines

License

Open Source License

Declaration

private static ArrayList<String> toLines(InputStream is) 

Method Source Code

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

import java.io.InputStream;

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    private static ArrayList<String> toLines(InputStream is) {
        ArrayList<String> lines = new ArrayList<String>();
        Scanner in = new Scanner(is);
        while (in.hasNextLine()) {
            String line = in.nextLine().trim();
            if (line.length() > 0)
                lines.add(line);/*from   w ww  .  j  a  v a 2  s.c  om*/
        }
        return lines;
    }
}

Related

  1. toLines(InputStream is)