Simple JAVA-like Scanner implementation