Class: RDF::Raptor::FFI::V2::IOStream
- Inherits:
-
FFI::ManagedStruct
- Object
- FFI::ManagedStruct
- RDF::Raptor::FFI::V2::IOStream
- Includes:
- RDF::Raptor::FFI
- Defined in:
- lib/rdf/raptor/ffi/v2/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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rdf/raptor/ffi/v2/iostream.rb', line 26 def initialize(ptr_or_obj, **) ptr = case ptr_or_obj when FFI::Pointer ptr_or_obj when V2::IOStreamHandler @handler = ptr_or_obj # prevents premature GC V2.raptor_new_iostream_from_handler(V2.world, self, @handler) when File, Tempfile V2.raptor_new_iostream_to_filename(V2.world, File.(ptr_or_obj.path)) when false V2.raptor_new_iostream_to_sink(V2.world) else nil end raise ArgumentError, "invalid argument: #{ptr_or_obj.inspect}" if ptr.nil? || ptr.null? @free_iostream = [:free_iostream] || true super(ptr) end |
Class Method Details
.release(ptr)
This method returns an undefined value.
Releases libraptor
memory associated with this structure.
50 51 52 53 54 |
# File 'lib/rdf/raptor/ffi/v2/iostream.rb', line 50 def self.release(ptr) if @free_iostream V2.raptor_free_iostream(ptr) end end |