DitchOoM / buffer

Kotlin Multiplatform bytebuffer/byte[] wrapper
Apache License 2.0
63 stars 5 forks source link

Bytearray wrap support #6

Closed litclimbing closed 2 years ago

litclimbing commented 2 years ago

I'm not sure if this is a change you'll be interested in but it made a lot of sense for my project.

I added support to wrap byte arrays but to do this cleanly I refactored the allocation function into a companion function for PlatformBuffer. It made more sense to me to write PlatformBuffer.allocate() and PlatformBuffer.wrap() than having top level functions for them. I wasn't sure how to actually wrap the array on JS without using the NativeBuffer so it currently copies it.

I also removed the ParcelablePlatformBuffer class and just added the Parcelable interface to the PlatformBuffer class directly. I didn't see a clear reason for the extra class and it adds ambiguity since it is only actually parcelable on Android but the class name was always ParcelablePlatformBuffer.

thebehera commented 2 years ago

Could you resolve the merge conflicts? Thanks!

I still need to think about this, should be able to get back to you tomorrow

thebehera commented 2 years ago

Yeah take a look at resolving the conflicts and ill be able to get to you a day after that -- i just need to validate it works properly from a consuming library

litclimbing commented 2 years ago

Sorry I took so long to resolve them. I was working on another project.