|
jrunscript JavaScript built-ins | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--GLOBALS
Method Summary | |
<static> void
|
cat(obj, pattern)
Shows the content of a file, URL or InputStream |
<static> void
|
cd(target)
Changes the present working directory to the given directory |
<static> void
|
cp(from, to)
Copies a file, URL, or stream to another file or stream |
<static> void
|
date()
Prints the current date using the current locale |
<static> void
|
del(pathname)
A synonym for 'rm' |
<static> void
|
dir(d, filter)
A synonym for 'ls'. |
<static> Object
|
dirname(pathname)
Returns the directory part of a filename |
<static> void
|
echo(x)
Echoes the given string arguments |
<static> void
|
exec(cmd)
Execs a child process, waits for completion & returns exit code |
<static> void
|
exit(code)
Exit the shell program. |
<static> void
|
find(dir, pattern, callback)
Find in files. |
<static> void
|
grep(pattern, files )
Unix-like grep, but accepts JavaScript regex patterns |
<static> void
|
ip(name)
Prints the IP addresses of a given domain name |
<static> void
|
load(str)
Loads and evaluates JavaScript code from a stream, file, or URL |
<static> void
|
ls(dir, filter)
Lists the files in a directory |
<static> void
|
mkdir(dir)
Creates a new directory of a given name |
<static> void
|
mkdirs(dir)
Creates a directory, including any necessary but nonexistent parent directories. |
<static> void
|
mv(from, to)
Moves a file to another |
<static> Object
|
printf(format, args)
A C-like printf |
<static> void
|
pwd()
Print the working directory |
<static> void
|
quit(code)
synonym for exit |
<static> Object
|
read(prompt, multiline)
Reads one or more lines from stdin after printing a prompt |
<static> void
|
ren(from, to)
A synonym for 'mv'. |
<static> Object
|
rm(pathname)
Removes a given file |
<static> void
|
rmdir(pathname)
Removes a given directory |
<static> void
|
which(cmd)
Prints which command is selected from PATH |
<static> Object
|
XMLDocument(inp)
Converts input to DOM Document object |
<static> Object
|
XMLResult(out)
Converts an arbitrary stream, file to an XMLResult |
<static> Object
|
XMLSource(inp)
Converts an arbitrary stream, file, URL to an XMLSource |
<static> void
|
XSLTransform(inp, style, out)
Perform XSLT transform |
Method Detail |
<static> void cat(obj, pattern)
cat('test.txt'); // show test.txt file contents
cat('http://java.net'); // show the contents from the URL http://java.net
obj
- input to show
pattern
- optional. Show only the lines matching the pattern
<static> void cd(target)
target
- the directory to change to. optional, defaults to user's HOME
<static> void cp(from, to)
from
- the input file, URL, or stream
to
- the output stream or file
<static> void date()
<static> void del(pathname)
<static> void dir(d, filter)
<static> Object dirname(pathname)
pathname
- the input path name
<static> void echo(x)
<static> void exec(cmd)
cmd
- the command to execute in child process
<static> void exit(exitCode)
exitCode
- the integer code to be returned to the OS shell. Optional, defaults to 0
<static> void find(dir, pattern, callback)
find('.')
find('.', '.*\.class', rm); // remove all .class files
find('.', '.*\.java'); // print fullpath of each .java file
find('.', '.*\.java', cat); // print all .java files
dir
- the directory of files to search
pattern
- the pattern to search for
callback
- the function to call for matching files
<static> void grep(pattern, files )
pattern
- the pattern to search for
files
- one or more files to be searched
<static> void ip(name)
name
- the domain name
<static> void load(str)
load('test.js'); // load script file 'test.js'
load('http://java.sun.com/foo.js'); // load from a URL
str
- the input from which the script is loaded and evaluated
<static> void ls(dir, filter)
dir
- the directory from which to list the files. Optional, default to pwd
filter
- a pattern to filter the files listed. Optional, default is '.'
<static> void mkdir(dir)
dir
- the name of the new directory
<static> void mkdirs(dir)
dir
- the pathname of the directory to be created
<static> void mv(from, to)
from
- the original name of the file
to
- the new name for the file
<static> Object printf(format, args)
format
- the string to format the rest of the print items
args
- the variadic argument list
<static> void pwd()
<static> void quit(code)
<static> Object read(prompt, multiline)
prompt
- the prompt. Optional, default is '>'
multiline
- if 0, read a single line, else read multiple lines
<static> void ren(from, to)
<static> Object rm(pathname)
pathname
- the name of the file
<static> void rmdir(pathname)
pathname
- the name of the directory
<static> void which(cmd)
cmd
- the name of the command searched from PATH
<static> Object XMLDocument(inp)
inp
- a file or reader. Optional, If missing a new DOM Document is returned.
<static> Object XMLResult(out)
inp
- the input stream or file
<static> Object XMLSource(inp)
inp
- the input stream, file, or URL
<static> void XSLTransform(inp, style, out)
inp
- the input XML to transform (URL, File or InputStream)
style
- the XSL Stylesheet to be used (URL, File or InputStream). Optional.
out
- the output XML (File or OutputStream)
|
jrunscript JavaScript built-ins | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |