Hi all, my question is ,I am checking a character from a file using read(),if false I want to go back to the character I just read(if I read again I should get the character I just read) ( I mean move the file marker one character back,is it possisible? THANKS pradeep
Failure is not when you fall down; its only when you fail to get up again.
There are two ways you can do this. One is using the "mark()" method of InputStream. You can mark a stream at some point, and then call reset() to reset the stream back to that same point. Not all streams support this, though, and marking before every single-character read may unwieldly. Another possibility it to use PushbackInputStream or PushbackReader as a wrapper around your file stream. These classes give you the ability to "unread" characters so that they can be read again.