ByteChannel
Stay organized with collections
Save and categorize content based on your preferences.
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. |
|
Inherited Method Summary
From interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-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 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eByteChannel\u003c/code\u003e is an interface that combines reading and writing bytes, unifying \u003ccode\u003eReadableByteChannel\u003c/code\u003e and \u003ccode\u003eWritableByteChannel\u003c/code\u003e functionalities.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits core methods like \u003ccode\u003eread()\u003c/code\u003e and \u003ccode\u003ewrite()\u003c/code\u003e for byte manipulation, \u003ccode\u003eclose()\u003c/code\u003e and \u003ccode\u003eisOpen()\u003c/code\u003e for channel management.\u003c/p\u003e\n"],["\u003cp\u003eNotable subclasses include \u003ccode\u003eDatagramChannel\u003c/code\u003e, \u003ccode\u003eFileChannel\u003c/code\u003e, \u003ccode\u003eSeekableByteChannel\u003c/code\u003e, and \u003ccode\u003eSocketChannel\u003c/code\u003e, each offering specific I/O capabilities.\u003c/p\u003e\n"],["\u003cp\u003eThis interface primarily focuses on providing a unified contract for byte-oriented channel operations without introducing new methods.\u003c/p\u003e\n"]]],[],null,["public interface **ByteChannel** implements [ReadableByteChannel](../../../../reference/java/nio/channels/ReadableByteChannel.html) [WritableByteChannel](../../../../reference/java/nio/channels/WritableByteChannel.html) \n\n|---|---|---|\n| Known Indirect Subclasses [DatagramChannel](../../../../reference/java/nio/channels/DatagramChannel.html), [FileChannel](../../../../reference/java/nio/channels/FileChannel.html), [SeekableByteChannel](../../../../reference/java/nio/channels/SeekableByteChannel.html), [SocketChannel](../../../../reference/java/nio/channels/SocketChannel.html) |-----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | [DatagramChannel](../../../../reference/java/nio/channels/DatagramChannel.html) | A selectable channel for datagram-oriented sockets. | | [FileChannel](../../../../reference/java/nio/channels/FileChannel.html) | A channel for reading, writing, mapping, and manipulating a file. | | [SeekableByteChannel](../../../../reference/java/nio/channels/SeekableByteChannel.html) | A byte channel that maintains a current *position* and allows the position to be changed. | | [SocketChannel](../../../../reference/java/nio/channels/SocketChannel.html) | A selectable channel for stream-oriented connecting sockets. | |||\n\nA channel that can read and write bytes. This interface simply unifies\n[ReadableByteChannel](../../../../reference/java/nio/channels/ReadableByteChannel.html) and [WritableByteChannel](../../../../reference/java/nio/channels/WritableByteChannel.html); it does not\nspecify any new operations. \n\nInherited Method Summary \nFrom interface [java.nio.channels.ReadableByteChannel](../../../../reference/java/nio/channels/ReadableByteChannel.html) \n\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract int | [read](../../../../reference/java/nio/channels/ReadableByteChannel.html#read(java.nio.ByteBuffer))([ByteBuffer](../../../../reference/java/nio/ByteBuffer.html) dst) Reads a sequence of bytes from this channel into the given buffer. |\n\nFrom interface [java.nio.channels.WritableByteChannel](../../../../reference/java/nio/channels/WritableByteChannel.html) \n\n|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract int | [write](../../../../reference/java/nio/channels/WritableByteChannel.html#write(java.nio.ByteBuffer))([ByteBuffer](../../../../reference/java/nio/ByteBuffer.html) src) Writes a sequence of bytes to this channel from the given buffer. |\n\nFrom interface [java.nio.channels.Channel](../../../../reference/java/nio/channels/Channel.html) \n\n|------------------|----------------------------------------------------------------------------------------------------------------------|\n| abstract void | [close](../../../../reference/java/nio/channels/Channel.html#close())() Closes this channel. |\n| abstract boolean | [isOpen](../../../../reference/java/nio/channels/Channel.html#isOpen())() Tells whether or not this channel is open. |\n\nFrom interface [java.io.Closeable](../../../../reference/java/io/Closeable.html) \n\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [close](../../../../reference/java/io/Closeable.html#close())() Closes this stream and releases any system resources associated with it. |\n\nFrom interface [java.lang.AutoCloseable](../../../../reference/java/lang/AutoCloseable.html) \n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [close](../../../../reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |"]]