Java java.io.ioexception: push back buffer is full
Why the push back buffer is full exception happens? Let's first see what is a push back buffer.
A push back buffer is an internal buffer inside a push back reader. And a push back reader is just a wrapper on an input stream. The stream can comes from string, file or standard IO, System.in.
As the name indicated, this kind of read can read or unread(push back) chars from stream.
The read operation will free spaces in push back buffer, one slot a time and unread will consume the buffer.
By default, the buffer size is 1, which means one unread operation will make it full and one read operation will make it empty.
You get this buffer full because there are more unread operations than read. For example one read and following two unread operations will throw this exception.
You should check the buffer size and how it was used.
The easiest solution will be increase the buffer size on construction.
(java.io.PushbackReader. (java.io.InputStreamReader. (java.io.ByteArrayInputStream. (.getBytes "hello\n"))) 100)