Here you can find the source of toBufferedReader(Reader reader)
Parameter | Description |
---|---|
reader | a reader to convert to a buffered reader |
Parameter | Description |
---|---|
NullPointerException | if the argument is null |
public static BufferedReader toBufferedReader(Reader reader)
//package com.java2s; //License from project: Open Source License import static com.google.common.base.Preconditions.*; import java.io.BufferedReader; import java.io.Reader; public class Main { /**/*from w w w . ja v a2s . com*/ * Returns the given {@link Reader} cast to a {@link BufferedReader} if possible, * otherwise wraps it into a new {@link BufferedReader}. * * @param reader a reader to convert to a buffered reader * @return a buffered reader * @throws NullPointerException if the argument is null */ public static BufferedReader toBufferedReader(Reader reader) { checkNotNull(reader, "reader must not be null"); if (reader instanceof BufferedReader) return (BufferedReader) reader; return new BufferedReader(reader); } }