Class IOOutputStream

java.lang.Object
java.io.OutputStream
org.jruby.util.IOOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class IOOutputStream extends OutputStream
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.
  • Field Details

    • io

      private final IRubyObject io
    • realIO

      private final RubyIO realIO
    • runtime

      private final Ruby runtime
    • writeAdapter

      private final CallSite writeAdapter
    • closeAdapter

      private final CallSite closeAdapter
    • encoding

      private final org.jcodings.Encoding encoding
  • Constructor Details

    • IOOutputStream

      public IOOutputStream(IRubyObject io, org.jcodings.Encoding encoding, boolean checkAppend, boolean verifyCanWrite)
      Creates a new OutputStream with the object provided.
      Parameters:
      io - the ruby object
    • IOOutputStream

      public IOOutputStream(IRubyObject io, boolean checkAppend, boolean verifyCanWrite)
    • IOOutputStream

      public IOOutputStream(IRubyObject io)
      Creates a new OutputStream with the object provided.
      Parameters:
      io - the ruby object
    • IOOutputStream

      public IOOutputStream(IRubyObject io, org.jcodings.Encoding encoding)
  • Method Details