Windows doesn't actually end the stream when you press Ctrl+Z; you can continue to edit the line and the application will only see the end of the stream when you press Return.
This is slightly different to Unix where Ctrl+D will send the current buffered line to the application (without a newline) and the application will only perceive the end of the stream when you send an empty buffer by pressing Ctrl+D either after a Return or after another Ctrl+D.
Edit: On Windows, you might be able to use the SetConsoleMode function to allow you to read single characters. I'm not sure how you would call it though; there appear to be three choices:
- Via JNI to a DLL that calls SetConsoleMode
- Invoke a program that calls SetConsoleMode
- Wrap your program in a launcher that calls SetConsoleMode
- Edit: Use JNA to call SetConsoleMode.