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

Add ByteBuffer support to BufferedWriter #2707

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

glbrntt
Copy link
Contributor

@glbrntt glbrntt commented Apr 26, 2024

Motivation:

The BufferedWriter in NIOFileSystem has API in terms of some Sequence<UInt8>, meaning that you need to pass byteBuffer.readableBytesView which is a bit inconvenient.

Modifications:

  • Add overloads which allow you to pass ByteBuffer directly
  • Remove redundant availability guards; they are already applied to the type

Result:

Motivation:

The `BufferedWriter` in `NIOFileSystem` has API in terms
of `some Sequence<UInt8>`, meaning that you need to pass
`byteBuffer.readableBytesView` which is a bit inconvenient.

Modifications:

- Add overloads which allow you to pass `ByteBuffer` directly
- Remove redundant availability guards; they are already applied to the
  type

Result:

- Better API for users
- Resolves apple#2662
@glbrntt glbrntt added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Apr 26, 2024
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one.

@glbrntt glbrntt merged commit f2f4ce8 into apple:main Apr 26, 2024
8 of 9 checks passed
@glbrntt glbrntt deleted the buffered-writer-bb branch April 26, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NIOFileSystem's BufferedWriter wants Sequence<UInt8>s and doesn't accept ByteBuffers
2 participants