org.jruby.util
Class IOInputStream
java.lang.Object
java.io.InputStream
org.jruby.util.IOInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class IOInputStream
- extends java.io.InputStream
This class wraps a IRubyObject in an InputStream. 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 reading, and the only requirement on the io-object is
that it responds to read() like IO.
Methods inherited from class java.io.InputStream |
mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IOInputStream
public IOInputStream(IRubyObject io)
- Creates a new InputStream 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
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Overrides:
available
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Overrides:
read
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
read
in class java.io.InputStream
- Throws:
java.io.IOException
Copyright © 2002-2009 JRuby Team. All Rights Reserved.