C# implementation of PushbackInputStream

Posted by Mark Heath on Stack Overflow See other posts from Stack Overflow or by Mark Heath
Published on 2009-01-27T10:15:05Z Indexed on 2010/06/16 22:02 UTC
Read the original article Hit count: 245

Filed under:

I need a C# implementation of Java's PushbackInputStream. I have made my own very basic one, but I wondered if there was a well tested and decently performing version already available somewhere. As it happens I always push back the same bytes I read so really it just needs to be able to reposition backwards, buffering up to a number of bytes I specify. (like Java's BufferedInputStream with the mark and reset methods).

Update: I should add that I can't simply reposition the stream as CanSeek may be false. (e.g. when the input steam is a NetworkStream)

© Stack Overflow or respective owner

Related posts about c#