Java InputStream Read Line readLines(ByteArrayInputStream outputSource)

Here you can find the source of readLines(ByteArrayInputStream outputSource)

Description

read Lines

License

Apache License

Declaration

private static String[] readLines(ByteArrayInputStream outputSource) 

Method Source Code

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

import java.io.ByteArrayInputStream;

import java.io.IOException;

import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.ArrayList;

public class Main {
    private static String[] readLines(ByteArrayInputStream outputSource) {
        try {/*from  w  ww. ja  va  2s.c  om*/
            ArrayList<String> retval = new ArrayList<>();
            final LineNumberReader reader = new LineNumberReader(new InputStreamReader(outputSource));
            String line = null;
            while ((line = reader.readLine()) != null) {
                retval.add(line);
            }
            return retval.toArray(new String[retval.size()]);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. readLines(final InputStream in)
  2. readLines(final InputStream input, final String encoding)
  3. readLines(final InputStream inputStream)
  4. readLines(final InputStream inputStream)