Java BufferedReader Create getReader(final String fileName)

Here you can find the source of getReader(final String fileName)

Description

Get a BufferedReader for the file of the given fileName

License

Open Source License

Parameter

Parameter Description
fileName a parameter

Exception

Parameter Description
UnsupportedEncodingException an exception
FileNotFoundException an exception

Declaration

public static BufferedReader getReader(final String fileName)
        throws UnsupportedEncodingException, FileNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

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

import java.io.UnsupportedEncodingException;

public class Main {
    /**//from  w  w  w .  j av a2s.c  o  m
     * Get a BufferedReader for the file of the given fileName
     * @param fileName
     * @return
     * @throws UnsupportedEncodingException
     * @throws FileNotFoundException
     */
    public static BufferedReader getReader(final String fileName)
            throws UnsupportedEncodingException, FileNotFoundException {
        return getReader(new FileInputStream(fileName));
    }

    public static BufferedReader getReader(final InputStream in) throws UnsupportedEncodingException {
        return new BufferedReader(new InputStreamReader(in, "UTF-8"));
    }
}

Related

  1. getReader(File inFile)
  2. getReader(File queryFile)
  3. getReader(final File inputFile)
  4. getReader(final InputStream is, final String enc)
  5. getReader(final Object aReference, final String aResourceName)
  6. getReader(final String fileName)
  7. getReader(InputStream in)
  8. getReader(InputStream input)
  9. getReader(InputStream is)