com.aptana.ide.scripting.io
Class File

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.aptana.ide.scripting.io.File
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class File
extends org.mozilla.javascript.ScriptableObject

Simple File wrapper.

Author:
Kevin Lindsey
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
File()
          Create a new instance of File From Norris Boyd's sample: When Context.defineClass is called with this class, it will construct File.prototype using this constructor.
 
Method Summary
static void finishInit(org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.FunctionObject constructor, org.mozilla.javascript.Scriptable prototype)
          finishInit
 java.lang.String getClassName()
          Returns the name of this JavaScript class, "File".
static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx, java.lang.Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr)
          Construct a new JS File object
 boolean jsFunction_createDirectory(boolean recursive)
          Create a new directory for this File
 boolean jsFunction_createNewFile()
          Create a new text file for this File
 void jsFunction_deleteOnExit()
          jsFunction_deleteOnExit
 org.mozilla.javascript.Scriptable jsFunction_readLines()
          readLines
 boolean jsFunction_write(java.lang.String text)
          write
 java.lang.String jsGet_absolutePath()
           
 java.lang.String jsGet_baseName()
           
 boolean jsGet_canRead()
           
 boolean jsGet_canWrite()
           
 boolean jsGet_exists()
           
 java.lang.String jsGet_extension()
           
 boolean jsGet_isDirectory()
           
 boolean jsGet_isFile()
           
 org.mozilla.javascript.Scriptable jsGet_list()
           
 java.lang.String jsGet_name()
          Get the name of the file.
 org.mozilla.javascript.Scriptable jsGet_parentFile()
          Get the parent directory for this file
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

File

public File()
Create a new instance of File From Norris Boyd's sample: When Context.defineClass is called with this class, it will construct File.prototype using this constructor.

Method Detail

finishInit

public static void finishInit(org.mozilla.javascript.Scriptable scope,
                              org.mozilla.javascript.FunctionObject constructor,
                              org.mozilla.javascript.Scriptable prototype)
finishInit

Parameters:
scope -
constructor -
prototype -

getClassName

public java.lang.String getClassName()
Returns the name of this JavaScript class, "File".

Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject
Returns:
String

jsConstructor

public static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx,
                                                              java.lang.Object[] args,
                                                              org.mozilla.javascript.Function ctorObj,
                                                              boolean inNewExpr)
Construct a new JS File object

Parameters:
cx -
args -
ctorObj -
inNewExpr -
Returns:
Scriptable

jsFunction_createNewFile

public boolean jsFunction_createNewFile()
Create a new text file for this File

Returns:
boolean

jsFunction_createDirectory

public boolean jsFunction_createDirectory(boolean recursive)
Create a new directory for this File

Parameters:
recursive -
Returns:
boolean

jsFunction_deleteOnExit

public void jsFunction_deleteOnExit()
jsFunction_deleteOnExit


jsFunction_readLines

public org.mozilla.javascript.Scriptable jsFunction_readLines()
readLines

Returns:
A string array of all lines in the file

jsFunction_write

public boolean jsFunction_write(java.lang.String text)
write

Parameters:
text -
Returns:
boolean

jsGet_absolutePath

public java.lang.String jsGet_absolutePath()
Returns:
String

jsGet_baseName

public java.lang.String jsGet_baseName()
Returns:
String

jsGet_canRead

public boolean jsGet_canRead()
Returns:
boolean

jsGet_canWrite

public boolean jsGet_canWrite()
Returns:
boolean

jsGet_exists

public boolean jsGet_exists()
Returns:
boolean

jsGet_extension

public java.lang.String jsGet_extension()
Returns:
String

jsGet_isFile

public boolean jsGet_isFile()
Returns:
boolean

jsGet_isDirectory

public boolean jsGet_isDirectory()
Returns:
boolean

jsGet_list

public org.mozilla.javascript.Scriptable jsGet_list()
Returns:
Scriptable

jsGet_name

public java.lang.String jsGet_name()
Get the name of the file.

Returns:
String

jsGet_parentFile

public org.mozilla.javascript.Scriptable jsGet_parentFile()
Get the parent directory for this file

Returns:
Returns a new File object or undefined