Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.io.*;
- public class modScanner {
- private Reader reader;
- private char lastChar;
- private int start, finish;
- private StringBuilder string;
- private boolean used = false;
- public modScanner(Reader r){
- reader = r;
- }
- public modScanner(InputStream in){
- this(new BufferedReader(new InputStreamReader(in)));
- }
- public void close() throws IOException{
- reader.close();
- }
- private boolean nextSymbolReader() throws IOException {
- int ch = reader.read();
- if (ch >= 0){
- lastChar = (char) ch;
- return true;
- }
- return false;
- }
- private boolean createString() throws IOException{
- used = false;
- string.delete(0, string.length());
- // isNum = true;
- while(nextSymbolReader() && !Character.isWhitespace(lastChar)){
- // isNum = Character.isDigit(lastChar);
- string.append(lastChar);
- }
- return string.length() > 0;
- }
- public boolean hasNext() throws IOException{
- return string.length() > 0;
- }
- // public boolean hasNextInt() throws IOException{
- // //pass
- // return string.length() > 0 && isNum;
- // }
- public boolean hasNextLine() throws IOException{
- //pass
- return true;
- }
- public String next() throws IOException{
- return string.toString();
- }
- public int nextInt() throws IOException{
- return 0;
- }
- public String nextLine(){
- //pass
- return "";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement