Robin Redeker wrote:
> Hi,
>
> i'm currently running this expression and wonder why i
got a backtrace:
>
> st> ((ByteStream on: 'foobar') next: 3)!
st> ByteStream comment displayNl!
My instances are read/write streams specially crafted for
ByteArrays.
They are able to write binary data to them.
st> ByteArray comment displayNl!
My instances are similar to strings in that they are both
represented as
a sequence of bytes, but my individual elements are
integers, where as
a String's elements are characters.
In other words, if you really must use a ByteStream, do
ByteStream on:
'foobar' asByteArray. Otherwise, see ReadWriteStream,
ByteStream's
superclass, for an alternative.
> As the collection used internally in ByteStream is a
String (ByteStream>>#species returns that at least)
> (super next) returns a Character and not a
SmallInteger.
Stream>>#species and overriders refer to the kind of
collection
answered by #upTo: and other methods that "read
from" or "write to"
the stream, which works as expected. The question of the
underlying
collection's class is a PositionableStream-specific concept.
--
Stephen Compall
http://scompall.no
candysw.com/blog
_______________________________________________
help-smalltalk mailing list
help-smalltalk gnu.org
http://lists.gnu.org/mailman/listinfo/help-smalltalk
|