org.jruby.util
Class IOInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by 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.


Constructor Summary
IOInputStream(IRubyObject io)
          Creates a new InputStream with the object provided.
 
Method Summary
 int available()
           
 void close()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 
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
 

Constructor Detail

IOInputStream

public IOInputStream(IRubyObject io)
Creates a new InputStream with the object provided.

Parameters:
io - the ruby object
Method Detail

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-2007 JRuby Team. All Rights Reserved.