-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a hasNext #3
Comments
This seems like a good idea. I'll make the change and add the appropriate tests this week to make sure it doesn't break anything. |
While you are it, can you also add a constructor that accepts a BufferedReader too? Also you might want to implement some interface (e.g. Reader or InputStream) from the JDK. |
The InputReader currently supports an java.io.InputStream as well as an optional buffer size for the given input stream, I'll update the README soon as I can. I mistakingly thought the BufferedReader implemented the InputStream interface, but apparently, it does not. I'll open an issue to include the java.io.Reader interface, because why not? |
When you are designing a scanner like this, you want to take in a Reader at the end of the day since you can go to InputStream to a Reader but not other way. |
Can you simply add
boolean hasNext() {return num_bytes_read != -1;}
? This way I can fuzzy benchmark it - else your code throws exceptions in the end.The text was updated successfully, but these errors were encountered: