Package org.jruby.util
Class IOChannel
java.lang.Object
org.jruby.util.IOChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel
- Direct Known Subclasses:
IOChannel.IOReadableByteChannel,IOChannel.IOReadableWritableByteChannel,IOChannel.IOWritableByteChannel
Wrap an IO object in a Channel.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAReadableByteChannelwrapper around an IO-like Ruby object.static classAReadableByteChannelandWritableByteChannelwrapper around an IO-like Ruby object.static classAWritableByteChannelwrapper around an IO-like Ruby object. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected FunctionalCachingCallSiteinitReadSite(String readMethod) protected FunctionalCachingCallSitebooleanisOpen()protected static intread(Ruby runtime, IRubyObject io, FunctionalCachingCallSite read, ByteBuffer dst) protected static intwrite(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.
-
Field Details
-
io
-
runtime
-
-
Constructor Details
-
IOChannel
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isOpen
public boolean isOpen() -
read
protected static int read(Ruby runtime, IRubyObject io, FunctionalCachingCallSite read, ByteBuffer dst) throws IOException - Throws:
IOException
-
write
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.- Parameters:
runtime- the current runtimeio- the target IO-like objectwrite- the call site for making dynamic `write` callssrc- the data to write- Returns:
- the amount of data reported written by the dynamic `write` call
-
initReadSite
-
initWriteSite
-