char[] characterBuffer = new char[(int) res.getLength()]; int length = reader.read(characterBuffer);  reader.close();
int length = (int) res.getLength(); char[] characterBuffer = new char[length]; int read = 0; try { while (read < length) { int r = reader.read(characterBuffer, read, length - read); if (r == -1) break; read += r; } } finally { reader.close(); }
    public static Skin getSkin(Resource res, Application app) throws IOException {        String encoding = app.getProperty("skinCharset");        Reader reader;        if (encoding == null) {            reader = new InputStreamReader(res.getInputStream());        } else {            reader = new InputStreamReader(res.getInputStream(), encoding);        }        char[] characterBuffer = new char[(int) res.getLength()];        int length = reader.read(characterBuffer);        reader.close();        return new Skin(characterBuffer, length, app);    }