Skip to content

Add parameters startIndex and endIndex to BinaryFormat.decodeFromByteArray #3064

@jfontsaballs

Description

@jfontsaballs

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

I need to deserialize an object received from websockets as a byte array (the ktor client library stores received data as a ByteArray), but in the same message I need to pass additional information that is not to be deserialized. I want to avoid creating copies of the array for performance reasons, but with the current implementation I can not tell it to only use part of the array.

Describe the solution you'd like

Add parameters startIndex and endIndex to BinaryFormat.decodeFromByteArray. These parameters should have default parameters 0 and bytes.size. This is similar to how decodeToString is implemented.

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