Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ByteStrings #133

Closed
fzhinkin opened this issue Jun 12, 2023 · 2 comments · Fixed by #148
Closed

Implement ByteStrings #133

fzhinkin opened this issue Jun 12, 2023 · 2 comments · Fixed by #148
Assignees
Milestone

Comments

@fzhinkin
Copy link
Collaborator

Immutable array wrappers are ubiquitous in JVM ecosystem. These wrappers usually provide different handy methods like content-based equals/hashCode (allowing to use of such wrappers in hash-based data structures), string-like APIs to search for particular values or subsequences within a wrapper, copy or create a subsequence, and so on. Also, these wrappers guarantee that the backing array won’t change, no matter what. The latter allows to overcome the need for defensive array copies.

Okio already has ByteStrings, but these are intermingled with Okio internals. It would be nice to provide an implementation based on Okio ByteStrings, supported by kotlinx-io, but shipped as a different artifact so that users could include it in their projects separately.

@fzhinkin fzhinkin added this to the 0.2.0 milestone Jun 12, 2023
@fzhinkin fzhinkin self-assigned this Jun 12, 2023
@swankjesse
Copy link

Making Okio’s ByteString implement Comparable has proven quite handy in practice too.

For example, to deterministically order a bunch of protobufs I can sort by their encodings. Or perhaps I sort their hashes!

@fzhinkin
Copy link
Collaborator Author

Related issue: #115

@fzhinkin fzhinkin linked a pull request Jun 23, 2023 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants