org.luaj.vm2.lib.jse
Class JseIoLib
java.lang.Object
IoLib
org.luaj.vm2.lib.jse.JseIoLib
public class JseIoLib
- extends IoLib
Subclass of IoLib and therefore LibFunction which implements the lua standard io
library for the JSE platform.
It uses RandomAccessFile to implement seek on files.
Typically, this library is included as part of a call to
JsePlatform.standardGlobals()
Globals globals = JsePlatform.standardGlobals();
globals.get("io").get("write").call(LuaValue.valueOf("hello, world\n"));
For special cases where the smallest possible footprint is desired,
a minimal set of libraries could be loaded
directly via Globals#load(LuaValue) using code such as:
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new JseIoLib());
globals.get("io").get("write").call(LuaValue.valueOf("hello, world\n"));
However, other libraries such as MathLib are not loaded in this case.
This has been implemented to match as closely as possible the behavior in the corresponding library in C.
- See Also:
LibFunction,
JsePlatform,
org.luaj.vm2.lib.jme.JmePlatform,
IoLib,
JmeIoLib,
Lua 5.2 I/O Lib Reference
|
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 |
wrapStderr()
|
protected File |
wrapStdin()
|
protected File |
wrapStdout()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JseIoLib
public JseIoLib()
wrapStdin
protected File wrapStdin()
throws java.io.IOException
- Throws:
java.io.IOException
wrapStdout
protected File wrapStdout()
throws java.io.IOException
- Throws:
java.io.IOException
wrapStderr
protected File wrapStderr()
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.