src/test/java/de/blau/android/resources/EliTest.java
/**
     * Get a resource file as a String
     * 
     * @param path path for the resource
     * @return a resource file as a String
     */
Get a resource file as a String

@param path path for the resource
@return a resource file as a String
Get a resource file as a String @param path path for the resource @return a resource file as a String
String stringFromResource(@NonNull String path) {
        StringBuilder sb = new StringBuilder();
        try (InputStream is = getClass().getResourceAsStream(path)) {
            BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName(OsmXml.UTF_8)));
            int cp;
            while ((cp = rd.read()) != -1) {
                sb.append((char) cp);
            }
        } catch (IOException e) {
            fail(e.getMessage());
            e.printStackTrace();
        }
        return sb.toString();
    }
String stringFromResource ( @ NonNull String path ) { StringBuilder sb = new StringBuilder ( ) ; try ( InputStream is = getClass ( ) . getResourceAsStream ( path ) ) { BufferedReader rd = new BufferedReader ( new InputStreamReader ( is , Charset . forName ( OsmXml . UTF_8 ) ) ) ; int cp ; while ( ( cp = rd . read ( ) ) != - 1 ) { sb . append ( ( char ) cp ) ; } } catch ( IOException e ) { fail ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } return sb . toString ( ) ; }
Get a resource file as a String
Get a resource file as a String