Stay organized with collections
Save and categorize content based on your preferences.
Pipe
abstract class Pipe
A pair of channels that implements a unidirectional pipe.
A pipe consists of a pair of channels: A writable sink
channel and a readable source
channel. Once some bytes are written to the sink channel they can be read from the source channel in exactly the order in which they were written.
Whether or not a thread writing bytes to a pipe will block until another thread reads those bytes, or some previously-written bytes, from the pipe is system-dependent and therefore unspecified. Many pipe implementations will buffer up to a certain number of bytes between the sink and source channels, but such buffering should not be assumed.
Summary
Nested classes |
abstract |
A channel representing the writable end of a Pipe .
|
abstract |
A channel representing the readable end of a Pipe .
|
Protected constructors |
Initializes a new instance of this class.
|
Protected constructors
Pipe
protected Pipe()
Initializes a new instance of this class.
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Pipe\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPipe\n====\n\n```\nabstract class Pipe\n```\n\n|---|-----------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.nio.channels.Pipe](#) |\n\nA pair of channels that implements a unidirectional pipe.\n\nA pipe consists of a pair of channels: A writable [sink](/reference/kotlin/java/nio/channels/Pipe.SinkChannel) channel and a readable [source](/reference/kotlin/java/nio/channels/Pipe.SourceChannel) channel. Once some bytes are written to the sink channel they can be read from the source channel in exactly the order in which they were written.\n\nWhether or not a thread writing bytes to a pipe will block until another thread reads those bytes, or some previously-written bytes, from the pipe is system-dependent and therefore unspecified. Many pipe implementations will buffer up to a certain number of bytes between the sink and source channels, but such buffering should not be assumed.\n\nSummary\n-------\n\n| Nested classes ||\n|----------|---------------------------------------------------------------------------------------------------------------------------------|\n| abstract | [SinkChannel](/reference/kotlin/java/nio/channels/Pipe.SinkChannel) A channel representing the writable end of a [Pipe](#). |\n| abstract | [SourceChannel](/reference/kotlin/java/nio/channels/Pipe.SourceChannel) A channel representing the readable end of a [Pipe](#). |\n\n| Protected constructors ||\n|---------------------------------------------------------------|---|\n| [Pipe](#Pipe())`()` Initializes a new instance of this class. |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------|-------------------------------------------------------------|\n| open static [Pipe](#)! | [open](#open())`()` Opens a pipe. |\n| abstract [Pipe.SinkChannel](/reference/kotlin/java/nio/channels/Pipe.SinkChannel)! | [sink](#sink())`()` Returns this pipe's sink channel. |\n| abstract [Pipe.SourceChannel](/reference/kotlin/java/nio/channels/Pipe.SourceChannel)! | [source](#source())`()` Returns this pipe's source channel. |\n\nProtected constructors\n----------------------\n\n### Pipe\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected Pipe()\n```\n\nInitializes a new instance of this class.\n\nPublic methods\n--------------\n\n### open\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun open(): Pipe!\n```\n\nOpens a pipe.\n\nThe new pipe is created by invoking the [openPipe](/reference/kotlin/java/nio/channels/spi/SelectorProvider#openPipe()) method of the system-wide default [java.nio.channels.spi.SelectorProvider](/reference/kotlin/java/nio/channels/spi/SelectorProvider) object.\n\n| Return ||\n|------------|------------|\n| [Pipe](#)! | A new pipe |\n\n| Exceptions ||\n|-----------------------|------------------------|\n| `java.io.IOException` | If an I/O error occurs |\n\n### sink\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun sink(): Pipe.SinkChannel!\n```\n\nReturns this pipe's sink channel.\n\n| Return ||\n|---------------------------------------------------------------------------|--------------------------|\n| [Pipe.SinkChannel](/reference/kotlin/java/nio/channels/Pipe.SinkChannel)! | This pipe's sink channel |\n\n### source\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun source(): Pipe.SourceChannel!\n```\n\nReturns this pipe's source channel.\n\n| Return ||\n|-------------------------------------------------------------------------------|----------------------------|\n| [Pipe.SourceChannel](/reference/kotlin/java/nio/channels/Pipe.SourceChannel)! | This pipe's source channel |"]]