Java Utililty Methods InputStreamReader Read

List of utility methods to do InputStreamReader Read

Description

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

Method

ListreadFileList(File file)
read File List
List<File> files = new ArrayList<File>();
String path = file.getParentFile().getAbsolutePath();
BufferedReader content = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line = content.readLine();
while (line != null) {
    files.add(new File(path + "/" + line));
    line = content.readLine();
return files;
StringreadFileOneLine(String filename, String keyInLine)
read File One Line
File f = new File(filename);
if (!f.exists())
    return null;
FileInputStream fis = null;
InputStreamReader fsr = null;
BufferedReader reader1 = null;
String line;
try {
...
ReaderreadFileOrResource(String source)
read File Or Resource
Stream<Function<String, InputStream>> suppliers = Stream.of((path) -> {
    try {
        return new FileInputStream(path);
    } catch (FileNotFoundException e) {
        return null;
}, (path) -> Thread.currentThread().getContextClassLoader()
        .getResourceAsStream("org/openqa/grid/common/" + path),
...
StringreadFiles(String[] files, String encoding)
read Files
StringBuffer buffer = new StringBuffer();
for (String pathname : files) {
    File file = new File(pathname);
    buffer.append(readFile(file, encoding));
return buffer.toString();
StringBufferreadFileSB(File f)
read File SB
InputStream in = new FileInputStream(f);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer sb = new StringBuffer();
try {
    readFile(reader, sb);
} finally {
    reader.close();
return sb;
ArrayListreadFileToLines(File file)
Returns the contents of file as a List of the lines as defined by java.io.BufferedReader#readLine() (i.e.
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
ArrayList<String> lines = new ArrayList<>();
String line;
while ((line = reader.readLine()) != null) {
    lines.add(line);
return lines;
ListreadFileToList(String fileName, String codeing)
read File To List
List<String> list = new ArrayList<String>();
try {
    BufferedReader reader = new BufferedReader(
            new InputStreamReader(new FileInputStream(fileName), codeing));
    String data = null;
    do {
        data = reader.readLine();
        if (data == null)
...
SetreadFileToSet(String filePath, String fileEncoding)
read File To Set
if (fileEncoding == null) {
    fileEncoding = "utf-8";
File file = new File(filePath);
BufferedReader br = null;
String line = null;
Set<String> lineSet = new HashSet<String>();
try {
...
StringreadFileUtf8(IFile file)
read File Utf
if (file.isAccessible()) {
    InputStream inputStream = file.getContents(true);
    try {
        return readStringUtf8(inputStream);
    } finally {
        inputStream.close();
return null;
StringreadFileWithThrow(IFile in)
read File With Throw
InputStream contents = in.getContents();
return readStream(contents);