Java BufferedReader Create getBufferedReader(InputStream stream, String charset)

Here you can find the source of getBufferedReader(InputStream stream, String charset)

Description

get Buffered Reader

License

Open Source License

Declaration

private static BufferedReader getBufferedReader(InputStream stream, String charset)
            throws UnsupportedEncodingException 

Method Source Code

//package com.java2s;
/**/*  w  ww  .j av a 2 s .co  m*/
 * Aptana Studio
 * Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
 * Please see the license.html included with this distribution for details.
 * Any modifications to this file must keep this entire header intact.
 */

import java.io.BufferedReader;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

public class Main {
    /**
     * Default buffer size.
     */
    private static final int DEFAULT_SIZE = 15 * 1024;

    private static BufferedReader getBufferedReader(InputStream stream, String charset)
            throws UnsupportedEncodingException {
        InputStreamReader inputReader;
        if (charset == null) {
            inputReader = new InputStreamReader(stream);
        } else {
            inputReader = new InputStreamReader(stream, charset);
        }
        return new BufferedReader(inputReader, DEFAULT_SIZE);
    }
}

Related

  1. getBufferedReader(File file, String encoding)
  2. getBufferedReader(final File file)
  3. getBufferedReader(final InputStream inputstream)
  4. getBufferedReader(InputStream inputStream)
  5. getBufferedReader(InputStream inputStream, String charsetName)
  6. getBufferedReader(Reader r)
  7. getBufferedReader(Reader rd)
  8. getBufferedReader(String directory, String filename)
  9. getBufferedReader(String file)