String s = null;
try {
while ((s = is.readLine()) != null) {
StringTokenizer st = new StringTokenizer(s, "@", true);
String user = (String)st.nextElement();
st.nextElement();
String host = (String)st.nextElement();
System.out.println("User name: " + user +
"; host part: " + host);
// Presumably you would now do something
// with the user and host parts...
}
} catch (NoSuchElementException ix) {
System.err.println("Line " + is.getLineNumber() +
": Invalid input " + s);
} catch (IOException e) {
System.err.println(e);
}