Hi guys. Some time ago Henry spot to us a small improvement for WriteStream >> nextPutAll: that we are using in Fuel, but I think it can be general. Henry comment was exactly:
Also: For variableBytes classes, if you rewrite:
WriteStream
nextPutAll: aCollection
�
���� | newEnd |
���� collection class instSpec == aCollection class instSpec
ifFalse:
���� ��� [^ super nextPutAll: aCollection ].
�
���� newEnd := position + aCollection size.
���� newEnd > writeLimit ifTrue:
���� ��� [self growTo: newEnd + 10].
�
���� collection replaceFrom: position+1 to: newEnd� with:
aCollection startingAt: 1.
���� position := newEnd.
���
��� ^ aCollection
You can now pass all variableByte classes (Like ByteString) directly
to a stream with a ByteArray collection, and the
replaceFrom:to:with: