Java

Aus Info-Theke
Zur Navigation springen Zur Suche springen


Resource aus Jar lesen

InputReader input = getClass().getResourceAsStream("appl.properties");
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String line;
while( (line = reader.readLine()) != null)
   doIt(line);

Reguläre Ausdrücke

Pattern rexpr = Pattern.compile("Name: (\\w+)");
Matcher matcher;
while( (line = reader.readLine()) != null){
   if ( (matcher = rexpr.matcher(line)).find()){
      name = matcher.group(1);
   }
}