org.luaj.vm2.lib.jme
Class JmeIoLib

java.lang.Object
  extended by IoLib
      extended by org.luaj.vm2.lib.jme.JmeIoLib

public class JmeIoLib
extends IoLib

Subclass of IoLib and therefore LibFunction which implements the lua standard io library for the JSE platform.

The implementation of the is based on CLDC 1.0 and StreamConnection. However, seek is not supported.

Typically, this library is included as part of a call to JmePlatform.standardGlobals()

To instantiate and use it directly, link it into your globals table via LuaValue.load(LuaValue) using code such as:

 LuaTable _G = new LuaTable();
 LuaThread.setGlobals(_G);
 _G.load(new BaseLib());
 _G.load(new PackageLib());
 _G.load(new JmeIoLib());
 _G.get("io").get("write").call(LuaValue.valueOf("hello, world\n"));
  
Doing so will ensure the library is properly initialized and loaded into the globals table.

This has been implemented to match as closely as possible the behavior in the corresponding library in C.

See Also:
LibFunction, JsePlatform, JmePlatform, IoLib, JseIoLib, http://www.lua.org/manual/5.1/manual.html#5.6

Constructor Summary
JmeIoLib()
           
 
Method Summary
protected  File openFile(java.lang.String filename, boolean readMode, boolean appendMode, boolean updateMode, boolean binaryMode)
           
protected  File openProgram(java.lang.String prog, java.lang.String mode)
           
protected  File tmpFile()
           
protected  File wrapStdin()
           
protected  File wrapStdout()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmeIoLib

public JmeIoLib()
Method Detail

wrapStdin

protected File wrapStdin()
                  throws java.io.IOException
Throws:
java.io.IOException

wrapStdout

protected File wrapStdout()
                   throws java.io.IOException
Throws:
java.io.IOException

openFile

protected File openFile(java.lang.String filename,
                        boolean readMode,
                        boolean appendMode,
                        boolean updateMode,
                        boolean binaryMode)
                 throws java.io.IOException
Throws:
java.io.IOException

openProgram

protected File openProgram(java.lang.String prog,
                           java.lang.String mode)
                    throws java.io.IOException
Throws:
java.io.IOException

tmpFile

protected File tmpFile()
                throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2007-2013 Luaj.org. All Rights Reserved.