StdIn should be available() #725
Labels
⚙️ component: Pioneer
Issues about Pioneer own things (e.g. utils)
🚦 status: in progress
📖 theme: extensions
🐞 type: bug
When reading from
System.in
, some extra code is needed to avoid blocking on empty input:The standard I/O extension replaces
System.in
withStdIn
, a subclass ofInputStream
that forwardsread
calls to aStringReader
. But it doesn't forward or otherwise override other methods and soavailable()
is called onInputStream
, which returns 0. That means the blocking-prevention code above always leads to an empty array.A fix would override
available()
(and potentially similar methods) but as far as I can see, it can't be forwarded to the underlyingStringReader
and so would require some unfortunate byte counting.The text was updated successfully, but these errors were encountered: