org.jruby.ext.ffi
Class Factory

java.lang.Object
  extended by org.jruby.ext.ffi.Factory
Direct Known Subclasses:
JNAFactory

public abstract class Factory
extends java.lang.Object

A factory that can create a FFI Provider


Nested Class Summary
static class Factory.Service
           
 
Constructor Summary
protected Factory()
           
 
Method Summary
static Factory getInstance()
          Gets an instance of FFIProvider
abstract  Platform getPlatform()
          Gets the platform info for this FFIProvider.
 void init(Ruby runtime, RubyModule ffi)
          Registers FFI ruby classes/modules
abstract
<T> T
loadLibrary(java.lang.String libraryName, java.lang.Class<T> libraryClass)
          Loads a native library.
abstract  java.nio.channels.ByteChannel newByteChannel(int fd)
          Wraps a java.nio.ByteChannel around a native file descriptor
protected abstract  FFIProvider newProvider(Ruby runtime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory

protected Factory()
Method Detail

getInstance

public static final Factory getInstance()
Gets an instance of FFIProvider

Returns:
an instance of FFIProvider

init

public void init(Ruby runtime,
                 RubyModule ffi)
Registers FFI ruby classes/modules

Parameters:
module - the module to register the classes under

newProvider

protected abstract FFIProvider newProvider(Ruby runtime)

loadLibrary

public abstract <T> T loadLibrary(java.lang.String libraryName,
                                  java.lang.Class<T> libraryClass)
Loads a native library.

Type Parameters:
T -
Parameters:
libraryName - The name of the library to load.
libraryClass - The interface class to map to the library functions.
Returns:
A new instance of libraryClass that an access the library.

getPlatform

public abstract Platform getPlatform()
Gets the platform info for this FFIProvider.

Returns:
A platform information instance.

newByteChannel

public abstract java.nio.channels.ByteChannel newByteChannel(int fd)
Wraps a java.nio.ByteChannel around a native file descriptor



Copyright © 2002-2007 JRuby Team. All Rights Reserved.