<div><div class="gmail_quote"><div dir="auto">On Sat 29. Jul 2017 at 21:16, tim Rowledge <<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We recently changed ByteArray>at:put: to remove the backup conversion of the value to integer, for what seemed like decent reasons.<br>
<br>
It’s broken my WeatherStation code a little because there are places where I use<br>
{my byte stream} nextPutAll: (aString squeakToUtf8)<br>
or similar. #squeakToUtf8 returns a bytestring, and of course when the #nextPutAll: loop does its thing each character is pulled out as a Character (even though we know at this point it’s a byte value) - and we’ve just made it impossible to stick a character into a byte array.<br>
<br>
Clearly I could fix it reasonably trivially with a few #asByteArray type messages scattered around but it feels a bit tacky somehow. I see some faintly similar code with plausibly similar issues in WebSocket classes too, which would need some care. Not that I can see a lot of usage of that code…<br>
<br>
Performance isn’t a colossal issue for MQTT packets but it just rankles a bit to have a known byte valued string and then have to convert it to write it into a byte valued stream collection. KnowWhadIMean?</blockquote><div dir="auto"><br></div></div></div><div><div class="gmail_quote"><div dir="auto">It only worked accidentally - you can't put text in a binary stream. So either use a string stream or you put a byte array. </div><div dir="auto"><br></div><div dir="auto">It may make sense to create a #asUtf8Bytes method ... or maybe a #nextPutAllUtf8: which could avoid the extra copy.</div></div></div><div><div class="gmail_quote"><div dir="auto"><br></div><div dir="auto">- Bert -</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div>