2012/1/7 Sven Van Caekenberghe <sven@beta9.be>:
On 07 Jan 2012, at 14:19, Henrik Sperre Johansen wrote:
1) There's no next: into: (which returns the amount read). It's really the only way to do buffers without garbage allocations.
The 2 key methods for efficient IO are:
readInto: collection startingAt: offset count: requestedCount     "Read requestedCount elements into collection starting at offset,     returning the number of elements read, there could be less elements available."
next: count putAll: collection startingAt: offset     "Write count bytes from collection starting at offset."
All other bulk operations can be written in terms of these (see for example Zodiac streams).
Sven
+1. All streams should provide these API, and if possible, provide an optimized implementation. It was not the case in Squeak, i started to refactor a bit, but incrementally modifying this dinosaurus without creating circularities is a sport! I still have 3 years old refactorings unpublished because I'm not sure how to reproduce the changes in a safe order ;) Nicolas