What’s the reason you are using ArrayBuffer instead of Uint8Array on the JS 
side?

If you’d use Uint8Array instead, the method could be used like so:

bd2.writeData(bd1.array);


> On Feb 21, 2019, at 6:40 PM, Greg Dove <greg.d...@gmail.com> wrote:
> 
> Hi Harbs,
> 
> Part of the reason for posting this was to surface any concerns early.
> This is my fault because when I added these methods a few years back I
> thought it seemed ok to use BinaryData as the 'bytes' argument type in them
> at the time. But the issue there is that it breaks compatibility with swf
> interfaces for IExternalizable, because that becomes incompatible for
> readBytes/writeBytes in the IDataInput/IDataOutput interfaces.
> I guess it could be avoidable in other ways, but it seems better to go for
> the consistency and provide the writeBytes/readBytes methods as the native
> platform variants.
> 
> The change however is quite trivial:
> 
> what was
> function writeBytes(bytes:BinaryData, offset:uint = 0, length:uint = 0):void
> 
> will become
> 
> COMPILE::SWF
> public function writeBytes(bytes:ByteArray, offset:uint = 0, length:uint =
> 0):void
> 
> and
> COMPILE::JS
> public function writeBytes(bytes:ArrayBuffer, offset:uint = 0, length:uint
> = 0):void
> 
> and the original method signature will remain available as:
> public function writeBinaryData(bytes:BinaryData, offset:uint = 0,
> length:uint = 0):void
> 
> Likewise for the corresponding read methods. And although the code has
> changed slightly, it works as before.
> 
> So it is a simple search and replace in files
> 
> 
> On Thu, Feb 21, 2019 at 9:15 PM Harbs <harbs.li...@gmail.com> wrote:
> 
>> What did you change? I’m using these methods, so it’s significant to me.
>> 
>>> On Feb 21, 2019, at 7:20 AM, Greg Dove <greg.d...@gmail.com> wrote:
>>> 
>>> I had to change the writeBytes/readBytes method signatures.
>>> The original method signature is still available but will become
>>> writeBinaryData/readBinaryData
>> 
>> 

Reply via email to