Audio, Streams, and MailMessage question

Hans-Martin Mosner hmm at heeg.de
Wed Aug 22 18:35:31 UTC 2007


Brian Brown wrote:
>
> I have tried the following:
>
>     s := ReadWriteStream on: (ByteArray new: 5000).
>     s binary.
>     recorder recordedSound storeWAVSamplesOn: s.
>     ^ s.
>
> and then later, I send the  stream (s) to 
> MailMessage>>addAttachmentFrom:withName:
>
> The resultant email message looks fine and has an attached wav file
> with 0 bytes.
>
>
> MailMessage>>addAttachmentFrom:withName: creates a MIMEDocument and
> sends #upToEnd to the Stream to get the data. Senders in the image
> usually pass in a FileStream, and I don't understand the difference as
> to why another kind of stream would not work.
>
You're probably not resetting the ReadWriteStream. As it is positioned
at the end after writing, reading up to end will return 0 bytes :-)



More information about the Squeak-dev mailing list