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 class
AReadableByteChannel
wrapper around an IO-like Ruby object.static class
AReadableByteChannel
andWritableByteChannel
wrapper around an IO-like Ruby object.static class
AWritableByteChannel
wrapper around an IO-like Ruby object. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected FunctionalCachingCallSite
initReadSite
(String readMethod) protected FunctionalCachingCallSite
boolean
isOpen()
protected static int
read
(Ruby runtime, IRubyObject io, FunctionalCachingCallSite read, ByteBuffer dst) 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.
-
Field Details
-
io
-
runtime
-
-
Constructor Details
-
IOChannel
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in 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
-