Can I peek on a BufferedReader?

后端 未结 8 1860
别跟我提以往
别跟我提以往 2021-01-01 14:02

Is there a way to check if in BufferedReader object is something to read? Something like C++ cin.peek(). Thanks.

8条回答
  •  醉酒成梦
    2021-01-01 14:27

    You could use a PushBackReader to read a character, and then "push it back". That way you know for sure that something was there, without affecting its overall state - a "peek".

提交回复
热议问题