Skip to content
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

Open
pathikrit opened this issue May 23, 2017 · 4 comments
Open

Add a hasNext #3

pathikrit opened this issue May 23, 2017 · 4 comments

Comments

@pathikrit
Copy link

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.

@williamfiset
Copy link
Owner

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.

@pathikrit
Copy link
Author

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.

@williamfiset
Copy link
Owner

williamfiset commented May 25, 2017

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?

@pathikrit
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants