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

ListreadLines(InputStream stream)
read Lines
List<String> lines = new ArrayList<String>();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new InputStreamReader(stream));
    String line = null;
    while ((line = reader.readLine()) != null) {
        lines.add(line);
    return lines;
} finally {
    if (reader != null)
        reader.close();
ListreadLines(InputStream stream, String charset)
read Lines
BufferedReader br = new BufferedReader(new InputStreamReader(stream, charset));
ArrayList<String> ret = new ArrayList<>();
for (String line; (line = br.readLine()) != null; ret.add(line))
    ;
return ret;
ListreadLinesCommon(InputStream in)
read Lines Common
if (in == null) {
    throw new IOException("Input stream is null.");
List<String> list = new ArrayList<String>();
BufferedReader reader = null; 
try {
    reader = new BufferedReader(new InputStreamReader(in, DEFAULT_ENCODING));
    String line;
...
SetreadLineSet(InputStream stream)
read a set of string lines from input stream and close it
Set<String> values = new HashSet<String>();
try {
    LineNumberReader lineReader = new LineNumberReader(new InputStreamReader(stream));
    String line = null;
    while ((line = lineReader.readLine()) != null) {
        values.add(line);
    return values;
...
ListreadLinesStream(InputStream is, boolean trim)
read a stream and return lines
BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
List<String> lines = new ArrayList<String>();
String line;
while ((line = in.readLine()) != null) {
    if (trim) {
        line = line.replaceAll("^[\uFEFF-\uFFFF]+", ""); 
        line = line.replaceAll("\\[[a-z]\\]", ""); 
        line = line.trim();
...
StringreadLineString(InputStream is)
Read the stream until a CRLF (13-10)
String ret = "";
while (true) {
    byte[] tmp = readLineBA(is, 4 * 1024);
    if (tmp == null) {
        break;
    ret += new String(tmp);
    if (tmp[tmp.length - 1] == 10 && tmp[tmp.length - 2] == 13) {
...
StringreadLineStringBuilder(InputStream is)
read Line String Builder
String res = null;
StringBuilder sb = new StringBuilder(192); 
int temp = is.read();
while (temp != 0x0D) {
    if (sb.capacity() >= 4000) {
        sb.setLength(0);
        sb = null;
        return null; 
...
StringreadLineStringConcat(InputStream is)
read Line String Concat
String res = "";
int temp = is.read();
while (temp != 0x0D) {
    res += (char) temp;
    temp = is.read();
is.read(); 
return res;
...
StringreadLinesUntil(InputStream br, String ln)
read Lines Until
return readLinesUntil(br, ln, null);