Class: RDF::Raptor::FFI::V1::IOStream
- Inherits:
-
FFI::ManagedStruct
- Object
- FFI::ManagedStruct
- RDF::Raptor::FFI::V1::IOStream
- Includes:
- RDF::Raptor::FFI
- Defined in:
- lib/rdf/raptor/ffi/v1/iostream.rb
Overview
This class provides an I/O stream that can write to filenames, FILE*
, strings and user-defined output via callbacks.
Constant Summary
Constants included from RDF::Raptor::FFI
Class Method Summary collapse
-
.release(ptr)
Releases
libraptor
memory associated with this structure.
Instance Method Summary collapse
-
#initialize(ptr_or_obj, **options) ⇒ IOStream
constructor
A new instance of IOStream.
Methods included from RDF::Raptor::FFI
Constructor Details
#initialize(ptr) ⇒ IOStream #initialize(handler) ⇒ IOStream #initialize(file) ⇒ IOStream
Returns a new instance of IOStream.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rdf/raptor/ffi/v1/iostream.rb', line 21 def initialize(ptr_or_obj, **) ptr = case ptr_or_obj when FFI::Pointer ptr_or_obj when V1::IOStreamHandler @handler = ptr_or_obj # prevents premature GC V1.raptor_new_iostream_from_handler2(self, @handler) when File, Tempfile V1.raptor_new_iostream_to_filename(File.(ptr_or_obj.path)) when false V1.raptor_new_iostream_to_sink() else nil end @free_iostream = [:free_iostream] || true raise ArgumentError, "invalid argument: #{ptr_or_obj.inspect}" if ptr.nil? || ptr.null? super(ptr) end |
Class Method Details
.release(ptr)
This method returns an undefined value.
Releases libraptor
memory associated with this structure.
46 47 48 49 50 |
# File 'lib/rdf/raptor/ffi/v1/iostream.rb', line 46 def self.release(ptr) if @free_iostrem V1.raptor_free_iostream(ptr) end end |