Closed ghost closed 10 years ago
Honestly, I did not look into the buffered thing much... As far as the TerminalInputStream being wrapped, I mean... wrapping it broke the functionality so.. IDK.
Forgot to mention, I fixed Computer.read()
Well what's the issue when you try to use the BufferedInputStream?
Also, minor thing, don't change code from
if() {
To
if()
{
=P It's rather unprofessional for a project to have different styles for stuff like that throughout, and all of it is already in the first style.
Looking into it. That was when I removed the synchronization. The thing is: BufferedInputStream has a ton of concurrency stuff.. so..
Also, sorry about that :P
It looks like TerminalInputStream.read() isn't resetting index when it resets current. Could that be the issue?
It should be... If that were the issue it wouldn't work without the BufferedInputStream...
I think the fact that your test only does one read() call is the reason we're not seeing an issue without the buffered stream. If it were doing more than one, I bet there'd be a problem.
Oh wait you have that in an infinite loop... Shouldn't that prevent the other tests from running? Anyway yea fix the index thing and see if buffered stream works.
I didn't add my test to the others... As for the index thing, it isn't broken?
Oh, I'm sorry, I'm an idiot. I forgot I changed it...
Fixing it...
So it's working now?
Not with a BufferedInputStream...
Also, do you want me to fix my formatting derps?
So wait are you still getting that array index error?
It'd be appreciated =P
No. It works if I dont use a BufferedInputStream.
On it :P
Okay, what about BufferedInputStream? I didn't do anything to fix it...
This shouldn't have been merged. It doesn't currently work.
It doesn't? I thought there was just a problem with the BIS not working. And that was removed.
Yeah, what doesn't work?
The BIS?
Well I spoke a bit soon. It didn't work, but the issue was just an import of java.io.BufferedInputSream, which didn't exist. So it couldn't compile. Then there's a couple more minor issues that I just changed. For instance the test should use System.out, not System.err, and it should read one line instead of indefinitely.
There was also a problem with the new line character. The input stream didn't append it to Computer.read(), which lead to an issue where entering a blank string would cause an array index out of bounds exception. And now the test is capable of reading just one line.
Ah... Yeah, the err was just so I could see it in red :P Uhm...
Ah sorry. I should have tested before merging.
Got it! =P There were a couple weird issues that needed solving for BufferedInputStream to work but it's good now.
Cool! Glad to hear it!
For some reason, if I wrap TerminalInputStream in a BufferedInputStream it does not work as expected. Other than that, System.in works perfectly.