diff --git a/src/jse/org/luaj/vm2/lib/jse/JseIoLib.java b/src/jse/org/luaj/vm2/lib/jse/JseIoLib.java index 9655de26..83a7c13c 100644 --- a/src/jse/org/luaj/vm2/lib/jse/JseIoLib.java +++ b/src/jse/org/luaj/vm2/lib/jse/JseIoLib.java @@ -36,20 +36,20 @@ import org.luaj.vm2.LuaValue; import org.luaj.vm2.lib.IoLib; import org.luaj.vm2.lib.LibFunction; -/** - * Subclass of {@link IoLib} and therefore {@link LibFunction} which implements the lua standard {@code io} - * library for the JSE platform. - *
- * It uses RandomAccessFile to implement seek on files. +/** + * Subclass of {@link IoLib} and therefore {@link LibFunction} which implements the lua standard {@code io} + * library for the JSE platform. *
- * Typically, this library is included as part of a call to + * It uses RandomAccessFile to implement seek on files. + *
+ * Typically, this library is included as part of a call to * {@link org.luaj.vm2.lib.jse.JsePlatform#standardGlobals()} *
{@code
* 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, + * For special cases where the smallest possible footprint is desired, * a minimal set of libraries could be loaded * directly via {@link Globals#load(LuaValue)} using code such as: *
{@code
@@ -96,9 +96,9 @@ public class JseIoLib extends IoLib {
protected File openProgram(String prog, String mode) throws IOException {
final Process p = Runtime.getRuntime().exec(prog);
- return "w".equals(mode)?
- new FileImpl( p.getOutputStream() ):
- new FileImpl( p.getInputStream() );
+ return "w".equals(mode)?
+ new FileImpl( p.getOutputStream() ):
+ new FileImpl( p.getInputStream() );
}
protected File tmpFile() throws IOException {
@@ -133,7 +133,7 @@ public class JseIoLib extends IoLib {
this( null, null, o );
}
public String tojstring() {
- return "file ("+this.hashCode()+")";
+ return "file (" + (this.closed ? "closed" : this.hashCode()) + ")";
}
public boolean isstdfile() {
return file == null;
@@ -199,11 +199,11 @@ public class JseIoLib extends IoLib {
}
notimplemented();
return 0;
- }
+ }
- // return char if read, -1 if eof, throw IOException on other exception
+ // return char if read, -1 if eof, throw IOException on other exception
public int read() throws IOException {
- if ( is != null )
+ if ( is != null )
return is.read();
else if ( file != null ) {
return file.read();