Skip to content

Conversation

swankjesse
Copy link
Collaborator

I'm using Array instead of Pair<Socket, Socket> because Array is slightly more friendly to Java-language consumers.

I'm using Array<Socket> instead of Pair<Socket, Socket>
because Array is _slightly_ more friendly to Java-language
consumers.
import okio.Socket
import okio.Source

internal class PipeSocket(val sinkPipe: Pipe, val sourcePipe: Pipe) : Socket {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this the right name? InMemorySocket might better fit the public API?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it intended to be public in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, not public. But the name will show up in toString() etc.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this name

/** Returns a pair of mutually-connected sockets. */
abstract fun createSocketPair(): Pair<Socket, Socket>
/** Returns two mutually-connected sockets. */
abstract fun createSocketPair(): Array<Socket>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I checked our API dump and there’s very little we’re exporting from the kotlin stdlib in Okio’s API. The only one I saw was Options and TypedOptions both expose kotlin.collections.AbstractList as their supertype, instead of java.util.AbstractList.

@swankjesse swankjesse requested a review from JakeWharton June 12, 2025 13:16
@swankjesse swankjesse merged commit 4e40f38 into master Jun 13, 2025
11 checks passed
@swankjesse swankjesse deleted the jwilson.0612.pipe_socket branch June 13, 2025 05:38
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.

3 participants