biznesman

Untitled

Jul 24th, 2021
990
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.io.*;
  4.  
  5. public class modScanner {
  6.     private Reader reader;
  7.     private char lastChar;
  8.     private int start, finish;
  9.     private StringBuilder string;
  10.     private boolean used = false;
  11.  
  12.     public modScanner(Reader r){
  13.         reader = r;
  14.     }
  15.  
  16.     public modScanner(InputStream in){
  17.         this(new BufferedReader(new InputStreamReader(in)));
  18.     }
  19.  
  20.     public void close() throws IOException{
  21.         reader.close();
  22.     }
  23.  
  24.     private boolean nextSymbolReader() throws IOException {
  25.         int ch = reader.read();
  26.         if (ch >= 0){
  27.             lastChar = (char) ch;
  28.             return true;
  29.         }
  30.         return false;
  31.     }
  32.  
  33.     private boolean createString() throws IOException{
  34.         used = false;
  35.         string.delete(0, string.length());
  36. //        isNum = true;
  37.         while(nextSymbolReader() && !Character.isWhitespace(lastChar)){
  38. //            isNum = Character.isDigit(lastChar);
  39.             string.append(lastChar);
  40.         }
  41.         return string.length() > 0;
  42.     }
  43.  
  44.     public boolean hasNext() throws IOException{
  45.         return string.length() > 0;
  46.     }
  47.  
  48. //    public boolean hasNextInt() throws IOException{
  49. //        //pass
  50. //       return string.length() > 0 && isNum;
  51. //    }
  52.  
  53.     public boolean hasNextLine() throws IOException{
  54.         //pass
  55.         return true;
  56.     }
  57.  
  58.     public String next() throws IOException{
  59.         return string.toString();
  60.     }
  61.  
  62.     public int nextInt() throws IOException{
  63.         return 0;
  64.     }
  65.  
  66.     public String nextLine(){
  67.         //pass
  68.         return "";
  69.     }
  70. }
  71.  
RAW Paste Data