Stay organized with collections
Save and categorize content based on your preferences.
ByteChannel
public
interface
ByteChannel
implements
ReadableByteChannel,
WritableByteChannel
java.nio.channels.ByteChannel
|
Known indirect subclasses
DatagramChannel |
A selectable channel for datagram-oriented sockets.
|
FileChannel |
A channel for reading, writing, mapping, and manipulating a file.
|
SeekableByteChannel |
A byte channel that maintains a current position and allows the
position to be changed.
|
SocketChannel |
A selectable channel for stream-oriented connecting sockets.
|
|
A channel that can read and write bytes. This interface simply unifies
ReadableByteChannel
and WritableByteChannel
; it does not
specify any new operations.
Summary
Inherited methods |
|
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
|
|
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,["# ByteChannel\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Inherited Methods](#inhmethods) \n\nByteChannel\n===========\n\n\n`\npublic\n\n\ninterface\nByteChannel\n`\n\n\n`\n\n\nimplements\n\n`[ReadableByteChannel](/reference/java/nio/channels/ReadableByteChannel)`,\n\n`[WritableByteChannel](/reference/java/nio/channels/WritableByteChannel)`\n\n\n`\n\n|-------------------------------|\n| java.nio.channels.ByteChannel |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [DatagramChannel](/reference/java/nio/channels/DatagramChannel), [FileChannel](/reference/java/nio/channels/FileChannel), [SeekableByteChannel](/reference/java/nio/channels/SeekableByteChannel), [SocketChannel](/reference/java/nio/channels/SocketChannel) |-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | [DatagramChannel](/reference/java/nio/channels/DatagramChannel) | A selectable channel for datagram-oriented sockets. | | [FileChannel](/reference/java/nio/channels/FileChannel) | A channel for reading, writing, mapping, and manipulating a file. | | [SeekableByteChannel](/reference/java/nio/channels/SeekableByteChannel) | A byte channel that maintains a current *position* and allows the position to be changed. | | [SocketChannel](/reference/java/nio/channels/SocketChannel) | A selectable channel for stream-oriented connecting sockets. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA channel that can read and write bytes. This interface simply unifies\n[ReadableByteChannel](/reference/java/nio/channels/ReadableByteChannel) and [WritableByteChannel](/reference/java/nio/channels/WritableByteChannel); it does not\nspecify any new operations.\n\nSummary\n-------\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.nio.channels.ReadableByteChannel](/reference/java/nio/channels/ReadableByteChannel)` ` |-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int` | ` `[read](/reference/java/nio/channels/ReadableByteChannel#read(java.nio.ByteBuffer))`(`[ByteBuffer](/reference/java/nio/ByteBuffer)` dst) ` Reads a sequence of bytes from this channel into the given buffer. | ||\n| From interface ` `[java.nio.channels.WritableByteChannel](/reference/java/nio/channels/WritableByteChannel)` ` |-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int` | ` `[write](/reference/java/nio/channels/WritableByteChannel#write(java.nio.ByteBuffer))`(`[ByteBuffer](/reference/java/nio/ByteBuffer)` src) ` Writes a sequence of bytes to this channel from the given buffer. | ||\n| From interface ` `[java.nio.channels.Channel](/reference/java/nio/channels/Channel)` ` |---------------------|------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](/reference/java/nio/channels/Channel#close())`() ` Closes this channel. | | ` abstract boolean` | ` `[isOpen](/reference/java/nio/channels/Channel#isOpen())`() ` Tells whether or not this channel is open. | ||\n| From interface ` `[java.io.Closeable](/reference/java/io/Closeable)` ` |------------------|--------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](/reference/java/io/Closeable#close())`() ` Closes this stream and releases any system resources associated with it. | ||\n| From interface ` `[java.lang.AutoCloseable](/reference/java/lang/AutoCloseable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](/reference/java/lang/AutoCloseable#close())`() ` Closes this resource, relinquishing any underlying resources. | ||"]]