I've tried this code but always get me 'is' as NULL. My file is located at "res" folder.
StringBuffer str = new StringBuffer();
InputStream is = getClass().getResourceAsStream(filename);
if(is == null) {
System.out.println("'is' is null");
} else {
InputStreamReader reader = new InputStreamReader(is);
String line = null;
// Read a single line from the file. null represents the EOF.
while ((line = readLine(reader)) != null) {
// Append the read line to the main form with a linefeed ('\n')
str.append(line + "\n");
}
reader.close();
}
Someone knows what I'm doing wrong?
Thx!