Skip to content

Generalize Sink/Source API to accept BufferedSource/BufferedSink#1809

Closed
travisfw wants to merge 1 commit into
square:masterfrom
travisfw:1808
Closed

Generalize Sink/Source API to accept BufferedSource/BufferedSink#1809
travisfw wants to merge 1 commit into
square:masterfrom
travisfw:1808

Conversation

@travisfw

Copy link
Copy Markdown

Change Sink.write(source: Buffer, byteCount: Long) to accept BufferedSource and Source.read(sink: Buffer, byteCount: Long) to accept BufferedSink. Since Buffer implements both interfaces this is backward-compatible, but it removes the unnecessary constraint that callers must use a Buffer specifically.

Fixes #1808

Change `Sink.write(source: Buffer, byteCount: Long)` to accept
`BufferedSource` and `Source.read(sink: Buffer, byteCount: Long)` to
accept `BufferedSink`. Since `Buffer` implements both interfaces this is
backward-compatible, but it removes the unnecessary constraint that
callers must use a `Buffer` specifically.

Fixes square#1808
@travisfw

travisfw commented May 12, 2026

Copy link
Copy Markdown
Author

oops. The travisfw branch should not be in this PR. I don't know how that got associated with it. :(
I made this PR from the 1808 branch. travisfw branch should not be showing up here. I changed the group in travisfw so I could use my downstream edits separate from upstream.
Edit: fixed. I had committed to the wrong branch. Sorry for the noise. 1808 is on the right commit at this time.

@JakeWharton

Copy link
Copy Markdown
Collaborator

This would not be a binary-compatible change to make.

@JakeWharton

Copy link
Copy Markdown
Collaborator

#1808 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source.read should accept a BufferedSink not Buffer, and Sink.write should accept a BufferedSource

2 participants