Skip to content

Add more flexibility to BinaryFormat.encodeToByteArray #3065

@jfontsaballs

Description

@jfontsaballs

What is your use-case and why do you need this feature?

I want to append additional data to the byte array generated by encodeToByteArray without having to copy all data into a larger array unnecessarily. I need to send this ByteArray over websockets but not all data that needs to be sent can be serialized.

Describe the solution you'd like

Option 1

Add additional parameters to encodeToByteArray to request empty space at the beginning and end of the array the this function instantiates.

Option 2

Receive a lambda that received the required space and returns a ByteArray on which to write serialized data and the starting index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions