List of utility methods to do BufferedReader Create
BufferedReader | getStreamReader(InputStream input) Retrieves a reader instance that can be used to read the contents of an input stream. return new BufferedReader(new InputStreamReader(input)); |
String | getStreamText(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); ... |
BufferedReader | toBufferedReader(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); |
BufferedReader | toBufferedReader(InputStream is, String charset) to Buffered Reader return new BufferedReader(new InputStreamReader(is, charset)); |
BufferedReader | toBufferedReader(Reader reader) to Buffered Reader return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); |
BufferedReader | toBufferedReader(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); |
BufferedReader | toBufferedReader(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); |
BufferedReader | toBufferedReader(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); |
BufferedReader | toBufferedReader(String s) Convert a String to a BufferedReader. return new BufferedReader(new StringReader(s)); |