Hi, I need to retrieve the last object put on a Stream (well SmartRefStream does). This is very much like #ensureEndsWith:((ReadWriteStream on: String new) nextPutAll: 'abc'; back) -> $c ((ReadWriteStream on: String new) nextPutAll: 'abc'; back; position) -> 2. ((ReadWriteStream on: String new) nextPutAll: 'abc'; peekBack; position) -> 3. Note that neither back nor peekBack is understood by a WriteStream. It requires a ReadWriteStream. |
2014-07-28 17:02 GMT+02:00 Nicolas Cellier <[hidden email]>:
More exactly, I'd like to implement PositionnableStream>>peekBackFor: anObject to return a Boolean like peekFor: and it would be a good thing that peekBack answers the same Object. |
Hi Nicolas, Why can't you use peekLast? Seems to me ensureEndsWith: should be implemented in terms of peekLast. Aloha, Eliot (phone)
|
2014-07-28 21:46 GMT+02:00 Eliot Miranda <[hidden email]>:
Yes, peekLast sounds perfect. Case of blindness? Oh, I was looking in PositionnableStream which has peekBack... That might explain.
|
Free forum by Nabble | Edit this page |