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

StringreadFile(final String path)
read File
StringBuffer js = new StringBuffer();
BufferedReader reader = null;
FileInputStream fis = null;
InputStreamReader isr = null;
try {
    fis = new FileInputStream(path);
    isr = new InputStreamReader(fis, "UTF-8");
    reader = new BufferedReader(isr);
...
StringreadFile(IFile file)
read File
InputStream inputStream = file.getContents();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder sb = new StringBuilder();
try {
    char[] buf = new char[1024];
    int numRead = 0;
    while ((numRead = reader.read(buf)) != -1) {
        sb.append(buf, 0, numRead);
...
StringreadFile(IFile theFile)
read File
InputStream is = theFile.getContents();
Reader r = new InputStreamReader(is);
StringBuilder data = new StringBuilder();
char[] buffer = new char[Math.max(1024, is.available())];
int charsRead;
while ((charsRead = r.read(buffer)) >= 0)
    data.append(buffer, 0, charsRead);
return data.toString();
...
StringreadFile(InputStream aStream)
Reads the contents of the given stream as a String and closes the stream.
final StringBuilder text = new StringBuilder();
BufferedReader reader = null;
try {
    reader = new BufferedReader(new InputStreamReader(aStream));
    for (String line = reader.readLine(); line != null; line = reader.readLine()) {
        if (text.length() != 0) {
            text.append("\n");
        text.append(line);
} catch (IOException ex) {
    closeStream(reader);
    throw ex;
reader.close();
return text.toString();
StringreadFile(InputStream in)
read File
StringBuffer sb = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
try {
    readFile(reader, sb);
} finally {
    reader.close();
return sb.toString();
...
StringreadFile(InputStream in)
read File
final StringBuffer sBuffer = new StringBuffer();
final BufferedReader br = new BufferedReader(new InputStreamReader(in));
final char[] buffer = new char[1024];
int cnt;
while ((cnt = br.read(buffer, 0, buffer.length)) > -1) {
    sBuffer.append(buffer, 0, cnt);
br.close();
...
voidreadFile(InputStream inputStream)
read File
InputStreamReader in = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(in);
String line;
while ((line = reader.readLine()) != null) {
    System.out.println(line);
reader.close();
StringreadFile(InputStream inputStream)
Read a text file
BufferedReader fr = new BufferedReader(new InputStreamReader(inputStream));
String text = null;
StringBuffer sb = new StringBuffer("");
try {
    int bufsize = 1024;
    char[] buf = new char[bufsize];
    buf[0] = '\0';
    int len = -1;
...
StringreadFile(InputStream inputStream)
read File
if (inputStream != null) {
    BufferedInputStream stream = new BufferedInputStream(inputStream);
    BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
    StringBuffer fileData = new StringBuffer(1000);
    char[] buf = new char[1024];
    int numRead = 0;
    while ((numRead = reader.read(buf)) != -1) {
        String readData = String.valueOf(buf, 0, numRead);
...
StringreadFile(InputStream is)
read File
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try {
    StringBuilder sb = new StringBuilder(8192);
    String line;
    while ((line = br.readLine()) != null) {
        sb.append(line);
    return sb.toString();
...