Package org.jruby.util
Class IOInputStream
java.lang.Object
java.io.InputStream
org.jruby.util.IOInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
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
ConstructorsConstructorDescriptionCreates a new InputStream with the object provided.IOInputStream
(IRubyObject io, boolean verifyCanRead) -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
IOInputStream
Creates a new InputStream with the object provided.- Parameters:
io
- the ruby object
-
IOInputStream
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-