Java Utililty Methods BufferedReader Create

List of utility methods to do BufferedReader Create

Description

The list of methods to do BufferedReader Create are organized into topic(s).

Method

BufferedReadergetStreamReader(InputStream input)
Retrieves a reader instance that can be used to read the contents of an input stream.
return new BufferedReader(new InputStreamReader(input));
StringgetStreamText(InputStream stream)
getStreamText
String result = null;
try {
    StringWriter sw = new StringWriter();
    try {
        InputStreamReader isr = new InputStreamReader(stream);
        BufferedReader reader = new BufferedReader(isr);
        char[] buf = new char[1024];
        int numRead = reader.read(buf);
...
BufferedReadertoBufferedReader(final Reader reader)
Returns the given reader if it is a BufferedReader , otherwise creates a BufferedReader from the given reader.
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
BufferedReadertoBufferedReader(InputStream is, String charset)
to Buffered Reader
return new BufferedReader(new InputStreamReader(is, charset));
BufferedReadertoBufferedReader(Reader reader)
to Buffered Reader
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
BufferedReadertoBufferedReader(Reader reader)
Wraps the reader in a BufferedReader if not a subclass already.
if (reader == null) {
    throw new IllegalArgumentException("Reader cannot be null");
if (BufferedReader.class.isAssignableFrom(reader.getClass())) {
    return (BufferedReader) reader;
return new BufferedReader(reader);
BufferedReadertoBufferedReader(Reader reader)
Returns the given Reader cast to a BufferedReader if possible, otherwise wraps it into a new BufferedReader .
checkNotNull(reader, "reader must not be null");
if (reader instanceof BufferedReader)
    return (BufferedReader) reader;
return new BufferedReader(reader);
BufferedReadertoBufferedReader(Reader reader)
Returns the given reader if it is a BufferedReader , otherwise creates a toBufferedReader for the given reader.
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
BufferedReadertoBufferedReader(String s)
Convert a String to a BufferedReader.
return new BufferedReader(new StringReader(s));