|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pk.edu.niit.clarens.FileMethods
Handler for xmlrpc "file" methods. Methods implemented include "size", "md5", "read", "stat", "ls", and "grep".
Constructor Summary | |
FileMethods()
Trivial constructor. |
Method Summary | |
protected java.lang.Object |
execute(java.lang.String methodName,
java.util.Vector parameters)
Handle a xmlrpc request with no user information. |
java.lang.Object |
execute(java.lang.String methodName,
java.util.Vector parameters,
java.lang.String username,
java.lang.String password)
Handle a xmlrpc request. |
java.util.Vector |
grep(java.util.Vector arr,
java.lang.String input)
Search a list of files for lines matching a specific pattern. |
java.util.Vector |
ls(java.lang.String path,
java.lang.String pattern)
Get the contents of a directory. |
java.lang.String |
md5(java.lang.String fileName)
Generate a md5 sum for a file. |
java.lang.String |
read(java.lang.String filename,
int offset,
int length)
Read the contents of a file. |
java.lang.String |
size(java.lang.String filename)
Get the size of the file. |
java.util.Vector |
stat(java.lang.String filename)
Get information about a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileMethods()
Method Detail |
public java.lang.Object execute(java.lang.String methodName, java.util.Vector parameters, java.lang.String username, java.lang.String password) throws java.lang.Exception
execute
in interface org.apache.xmlrpc.AuthenticatedXmlRpcHandler
methodName
- The name of the system method being executed.parameters
- The method parameters.username
- The identity of the user performing the execution.password
- The password/key for the user performing the execution.
java.lang.Exception
- A generic exception is thrown for any errors.protected java.lang.Object execute(java.lang.String methodName, java.util.Vector parameters) throws java.lang.Exception
methodName
- The name of the system method being executed.parameters
- The method parameters.
java.lang.Exception
- A generic exception is thrown for any errors.public java.lang.String md5(java.lang.String fileName) throws java.lang.Exception
fileName
- The name of the file for which the md5 sum will be
calculated.
java.lang.Exception
- A generic exception is thrown for any errors.public java.lang.String size(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file for which the size will be returned.
java.lang.Exception
- A generic exception is thrown for any errors.public java.lang.String read(java.lang.String filename, int offset, int length) throws java.lang.Exception
filename
- The name of the file that will be read.offset
- The start offset for reading the file.length
- The number of bytes to read from the file.
java.lang.Exception
- A generic exception is thrown for any errors.public java.util.Vector stat(java.lang.String filename)
filename
- The name of the file to inquiry.
Vector
containing 3 values:
The file type
The file size (as an integer)
The file modification date (in seconds)public java.util.Vector ls(java.lang.String path, java.lang.String pattern)
path
- The name of the directory on which to perform the listing.pattern
- A glob pattern describing which files to return. An
empty pattern is equivalent to the glob pattern "*".
Vector
of file information. Each element of the
Vector
contains another Vector
containing the file
name, the file size, and the file modification date. The result vector
only contains information about files; it will not contain any entries
for directories.public java.util.Vector grep(java.util.Vector arr, java.lang.String input)
arr
- The list of files to search.input
- The input string to search for.
Vector
of lines containing the input pattern.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |