org.jruby.util
Class IOChannel
java.lang.Object
org.jruby.util.IOChannel
- All Implemented Interfaces:
- java.io.Closeable, java.nio.channels.Channel
- Direct Known Subclasses:
- IOChannel.IOReadableByteChannel, IOChannel.IOReadableWritableByteChannel, IOChannel.IOWritableByteChannel
public abstract class IOChannel
- extends java.lang.Object
- implements java.nio.channels.Channel
This class wraps a IRubyObject in an OutputStream. Depending on which messages
the IRubyObject answers to, it will have different functionality.
The point is that the IRubyObject could exhibit duck typing, in the style of IO versus StringIO, for example.
At the moment, the only functionality supported is writing, and the only requirement on the io-object is
that it responds to write() and close() like IO.
- Author:
- Ola Bini
Constructor Summary |
protected |
IOChannel(IRubyObject io)
Creates a new OutputStream with the object provided. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IOChannel
protected IOChannel(IRubyObject io)
- Creates a new OutputStream with the object provided.
- Parameters:
io
- the ruby object
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Specified by:
close
in interface java.nio.channels.Channel
- Throws:
java.io.IOException
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interface java.nio.channels.Channel
read
protected int read(CallSite read,
java.nio.ByteBuffer dst)
throws java.io.IOException
- Throws:
java.io.IOException
write
protected int write(CallSite write,
java.nio.ByteBuffer src)
throws java.io.IOException
- Throws:
java.io.IOException
initReadSite
protected CallSite initReadSite()
initWriteSite
protected CallSite initWriteSite()
Copyright © 2002-2009 JRuby Team. All Rights Reserved.