Example usage for com.badlogic.gdx.files FileHandle reader

List of usage examples for com.badlogic.gdx.files FileHandle reader

Introduction

In this page you can find the example usage for com.badlogic.gdx.files FileHandle reader.

Prototype

public BufferedReader reader(int bufferSize, String charset) 

Source Link

Document

Returns a buffered reader for reading this file as characters.

Usage

From source file:com.github.unluckyninja.mousekiller.utils.CharactersLoader.java

License:Open Source License

public static String getCharacters(FileHandle file) {
    String str = "";
    BufferedReader reader = file.reader(128, "UTF-8");
    try {//  ww w. j  av a 2 s .  com
        String s1;
        int i = 0;
        while ((s1 = reader.readLine()) != null) {
            if (!s1.startsWith("#")) {
                str += s1;
                ;
            }
        }
    } catch (IOException ex) {
        Logger.getLogger(CharactersLoader.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        try {
            reader.close();
        } catch (IOException ex) {
            Logger.getLogger(CharactersLoader.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return str.toString();
}