Java Utililty Methods InputStream Read Line

List of utility methods to do InputStream Read Line

Description

The list of methods to do InputStream Read Line are organized into topic(s).

Method

String[]readLines(ByteArrayInputStream outputSource)
read Lines
try {
    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()]);
...
String[]readLines(final InputStream in)
read Lines
final ArrayList<String> lines = new ArrayList<String>();
final InputStreamReader reader = new InputStreamReader(in);
final BufferedReader bufferedReader = new BufferedReader(reader);
String line = null;
while ((line = bufferedReader.readLine()) != null) {
    lines.add(line);
final String[] lineArray = lines.stream().toArray(String[]::new);
...
ListreadLines(final InputStream input, final String encoding)
Get the contents of an InputStream as a list of Strings, one entry per line, using the specified character encoding.
if (encoding == null) {
    return readLines(input);
} else {
    final InputStreamReader reader = new InputStreamReader(input, encoding);
    return readLines(reader);
ListreadLines(final InputStream inputStream)
This is a convenience method thread reads an input stream into a List
final String text = readStream(inputStream);
StringTokenizer tokenizer = new StringTokenizer(text, "\n\r");
List<String> list = new ArrayList<String>();
while (tokenizer.hasMoreElements()) {
    final String line = tokenizer.nextToken();
    list.add(line);
return list;
...
ListreadLines(final InputStream inputStream)
This is a convenience method thread reads an input stream into a List
final String text = readStream(inputStream);
StringTokenizer tokenizer = new StringTokenizer(text, "\n\r");
List<String> list = new ArrayList<String>();
while (tokenizer.hasMoreElements()) {
    final String line = tokenizer.nextToken();
    list.add(line);
return list;
...
ListreadLines(final InputStream is)
read Lines
try {
    final List<String> lines = new ArrayList<String>();
    final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    String line;
    while ((line = reader.readLine()) != null) {
        lines.add(line);
    return lines;
...
String[]readlines(final InputStream stream)
readlines
final BufferedReader br = new BufferedReader(new InputStreamReader(stream));
String line = null;
final List<String> allLines = new ArrayList<String>();
while ((line = br.readLine()) != null) {
    allLines.add(line);
return allLines.toArray(new String[allLines.size()]);
ListreadLines(InputStream in)
read Lines
List<String> lines = new ArrayList<String>();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new InputStreamReader(in));
    String line;
    while ((line = reader.readLine()) != null) {
        lines.add(line);
} finally {
    if (reader != null) {
        try {
            reader.close();
        } catch (IOException e) {
return lines;
ListreadLines(InputStream in)
read Lines
final List<String> result = new LinkedList<String>();
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
try {
    while ((line = reader.readLine()) != null) {
        result.add(line);
} catch (final IOException e) {
...
String[]readLines(InputStream in)
read Lines
List<String> r = new ArrayList<String>();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String l = br.readLine();
while (l != null) {
    r.add(l);
    l = br.readLine();
return r.toArray(new String[] {});
...