IOReadableByteChannel, IOWritableByteChannel, IOReadableWritableByteChannel
| Modifier and Type | Class and Description |
|---|---|
| public static class | IOChannel.
A |
| public static class | IOChannel.
A |
| public static class | IOChannel.
A |
| Modifier and Type | Field and Description |
|---|---|
| private final CallSite | |
| protected final IRubyObject | |
| private final CallSite | |
| private final RespondToCallSite | |
| protected final Ruby |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected FunctionalCachingCallSite | |
| protected FunctionalCachingCallSite | |
| public boolean | |
| protected static int | |
| protected static int | Returns: the amount of data reported written by the dynamic `write` callthe current runtime runtime, IRubyObject the target IO-like object io, FunctionalCachingCallSite the call site for making dynamic `write` calls write, ByteBuffer the data to write src)Perform a write to the given IO-like object, using the given call site, and passing the contents of the given buffer. |
| closeAdapter | back to summary |
|---|---|
| private final CallSite closeAdapter | |
| io | back to summary |
|---|---|
| protected final IRubyObject io | |
| isClosedAdapter | back to summary |
|---|---|
| private final CallSite isClosedAdapter | |
| respondToClosed | back to summary |
|---|---|
| private final RespondToCallSite respondToClosed | |
| runtime | back to summary |
|---|---|
| protected final Ruby runtime | |
| IOChannel | back to summary |
|---|---|
| protected IOChannel(final IRubyObject io) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this channel. After a channel is closed, any further attempt to invoke I/O
operations upon it will cause a If this channel is already closed then invoking this method has no effect. This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
| |
| initReadSite | back to summary |
|---|---|
| protected FunctionalCachingCallSite initReadSite(String readMethod) | |
| initWriteSite | back to summary |
|---|---|
| protected FunctionalCachingCallSite initWriteSite() | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
| |
| read | back to summary |
|---|---|
| protected static int read(Ruby runtime, IRubyObject io, FunctionalCachingCallSite read, ByteBuffer dst) throws IOException | |
| write | back to summary |
|---|---|
| protected static int write(Ruby runtime, IRubyObject io, FunctionalCachingCallSite write, ByteBuffer src) Perform a write to the given IO-like object, using the given call site, and passing the contents of the given buffer. The buffer and its contents should not be referenced beyond the method's return.
| |
ReadableByteChannel wrapper around an IO-like Ruby object.
| Modifier and Type | Field and Description |
|---|---|
| private final FunctionalCachingCallSite |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | read(ByteBuffer
The buffer into which bytes are to be transferred dst)Implements java. Reads a sequence of bytes from this channel into the given buffer. |
| read | back to summary |
|---|---|
| private final FunctionalCachingCallSite read | |
| IOReadableByteChannel | back to summary |
|---|---|
| public IOReadableByteChannel(final IRubyObject io) | |
| IOReadableByteChannel | back to summary |
|---|---|
| public IOReadableByteChannel(final IRubyObject io, final String readMethod) | |
| read | back to summary |
|---|---|
| public int read(ByteBuffer dst) throws IOException Implements java. Doc from java. Reads a sequence of bytes from this channel into the given buffer. An attempt is made to read up to r bytes from the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is read, where
A read operation might not fill the buffer, and in fact it might not read any bytes at all. Whether or not it does so depends upon the nature and state of the channel. A socket channel in non-blocking mode, for example, cannot read any more bytes than are immediately available from the socket's input buffer; similarly, a file channel cannot read any more bytes than remain in the file. It is guaranteed, however, that if a channel is in blocking mode and there is at least one byte remaining in the buffer then this method will block until at least one byte is read. This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
ReadableByteChannel and WritableByteChannel wrapper around an IO-like Ruby object.
| Modifier and Type | Field and Description |
|---|---|
| private final FunctionalCachingCallSite | |
| private final FunctionalCachingCallSite |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | read(ByteBuffer
The buffer into which bytes are to be transferred dst)Implements java. Reads a sequence of bytes from this channel into the given buffer. |
| public int | write(ByteBuffer
The buffer from which bytes are to be retrieved src)Implements java. Writes a sequence of bytes to this channel from the given buffer. |
| read | back to summary |
|---|---|
| private final FunctionalCachingCallSite read | |
| write | back to summary |
|---|---|
| private final FunctionalCachingCallSite write | |
| IOReadableWritableByteChannel | back to summary |
|---|---|
| public IOReadableWritableByteChannel(final IRubyObject io) | |
| read | back to summary |
|---|---|
| public int read(ByteBuffer dst) throws IOException Implements java. Doc from java. Reads a sequence of bytes from this channel into the given buffer. An attempt is made to read up to r bytes from the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is read, where
A read operation might not fill the buffer, and in fact it might not read any bytes at all. Whether or not it does so depends upon the nature and state of the channel. A socket channel in non-blocking mode, for example, cannot read any more bytes than are immediately available from the socket's input buffer; similarly, a file channel cannot read any more bytes than remain in the file. It is guaranteed, however, that if a channel is in blocking mode and there is at least one byte remaining in the buffer then this method will block until at least one byte is read. This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| write | back to summary |
|---|---|
| public int write(ByteBuffer src) throws IOException Implements java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. An attempt is made to write up to r bytes to the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is written, where
Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer. This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
WritableByteChannel wrapper around an IO-like Ruby object.
| Modifier and Type | Field and Description |
|---|---|
| private final FunctionalCachingCallSite |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | write(ByteBuffer
The buffer from which bytes are to be retrieved src)Implements java. Writes a sequence of bytes to this channel from the given buffer. |
| write | back to summary |
|---|---|
| private final FunctionalCachingCallSite write | |
| IOWritableByteChannel | back to summary |
|---|---|
| public IOWritableByteChannel(final IRubyObject io) | |
| write | back to summary |
|---|---|
| public int write(ByteBuffer src) throws IOException Implements java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. An attempt is made to write up to r bytes to the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is written, where
Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer. This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |