Java InputStreamReader Create getReaderForFile(IFile file)

Here you can find the source of getReaderForFile(IFile file)

Description

get Reader For File

License

Open Source License

Declaration

private static InputStreamReader getReaderForFile(IFile file)
            throws CoreException, UnsupportedEncodingException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik  
 * Rapperswil, University of applied sciences and others
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution, and is available at 
 * http://www.eclipse.org/legal/epl-v10.html  
 * /*ww  w  . j  av a  2s.co m*/
 * Contributors: 
 * Institute for Software - initial API and implementation 
 ******************************************************************************/

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

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;

public class Main {
    private static InputStreamReader getReaderForFile(IFile file)
            throws CoreException, UnsupportedEncodingException {
        InputStream contents = file.getContents();
        InputStreamReader r = new InputStreamReader(contents, file.getCharset());
        return r;
    }
}

Related

  1. getReader(final File file)
  2. getReader(final InputStream is)
  3. getReader(String name, String extension)
  4. readTextFile(File f)
  5. readTextFile(File f)
  6. readTextFile(File f)
  7. readTextFile(File f)