Java in a Nutshell, 5th Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java in a Nutshell, 5th Edition [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


WritableByteChanneljava.nio.channels

Java 1.4closeable

This subinterface of
Channel defines a single key write(
) method which writes bytes from a specified
ByteBuffer (updating the buffer position as it
goes) to the channel. If possible, it writes all remaining bytes in
the buffer (see Buffer.remaining( )). This is not
always possible (with nonblocking channels, for example) so the
write( ) method returns the number of bytes that
it was actually able to write to the channel.

write( ) is declared to throw an
IOException. More specifically, it may throw a
ClosedChannelException if the channel is closed.
If the channel is closed asynchronously, or if a blocked thread is
interrupted, the write(
)
method may terminate with an
AsynchronousCloseException or a
ClosedByInterruptException. write(
) may also throw an unchecked
NonWritableChannelException if it is called on a
channel (such as a FileChannel) that was not
opened or configured to allow writing.

WritableByteChannel implementations are required
to be thread-safe: only one thread may perform a write operation on a
channel at a time. If a write operation is in progress, then any call
to write( ) will block until the in-progress
operation completes. Some channel implementations may allow read and
write operations to proceed concurrently; some may not.


Figure 13-42. java.nio.channels.WritableByteChannel

public interface

WritableByteChannel extends Channel {
// Public Instance Methods
int

write (java.nio.ByteBuffer

src ) throws java.io.IOException;
}


Implementations


ByteChannel,
GatheringByteChannel,
Pipe.SinkChannel

Passed To


Channels.{newOutputStream( ), newWriter(
)}, FileChannel.transferTo( )

Returned By


Channels.newChannel( )


    / 1191