|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.File | +--com.dalsemi.fs.DSFile
An extension to the standard java.io.File
class. Methods are provided for accessing the
permissions and the owner ID. Instances of this class can also be used to execute the
file it represents, although the preferred way to execute a file is through the
methods provided in java.lang.Runtime
.
Fields inherited from class java.io.File |
pathSeparator,
pathSeparatorChar,
separator,
separatorChar |
Constructor Summary | |
DSFile(File dir,
String name)
Creates a new DSFile instance from a parent abstract
pathname and a child pathname string. |
|
DSFile(String path)
Creates a new DSFile instance by converting the given
pathname string into an abstract pathname. |
|
DSFile(String path,
String name)
Creates a new DSFile instance from a parent pathname string
and a child pathname string. |
Method Summary | |
static byte[] |
buildAbsolutePath(String parent,
String name)
Builds the fully qualified path name from the directory name and the file name. |
boolean |
canExec()
Determines if this file can be executed. |
int |
executeFile()
Executes this file as a new foreground process. |
int |
executeFile(InputStream stdin,
OutputStream stdout,
OutputStream stderr,
String[] args,
boolean foreground,
String processName)
Executes this file as a new process with the default environment. |
int |
executeFile(InputStream stdin,
OutputStream stdout,
OutputStream stderr,
String[] args,
String[] env,
boolean foreground,
String processName)
Executes this file. |
int |
executeFile(InputStream stdin,
OutputStream stdout,
OutputStream stderr,
String[] args,
String[] env,
boolean foreground,
String processName,
Process procObj)
Executes this file. |
int |
getOtherPermissions()
Retrieves the other (non-owner) permissions for this file. |
int |
getUser()
Gets the ID of the user (owner) of this file. |
int |
getUserPermissions()
Retrieves the user (owner) permissions for this file. |
boolean |
listLong(OutputStream out,
boolean unixStyle)
Prints a verbose file listing to the given stream. |
void |
setOtherPermissions(int perms)
Sets the other (non-owner) permissions for this file. |
void |
setUser(byte uid)
Sets the user (owner) of this file. |
void |
setUserPermissions(int perms)
Sets the user (owner) permissions for this file. |
void |
touch()
Sets the modified time of this file to the current time. |
Methods inherited from class java.io.File |
canRead,
canWrite,
delete,
equals,
exists,
getAbsolutePath,
getCanonicalPath,
getName,
getParent,
getPath,
hashCode,
isAbsolute,
isDirectory,
isFile,
lastModified,
length,
list,
list,
mkdir,
mkdirs,
renameTo,
toString |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public DSFile(String path)
DSFile
instance by converting the given
pathname string into an abstract pathname. If the given string is
the empty string, then the result is the empty abstract pathname.path
- the file pathnamenull
public DSFile(String path, String name)
DSFile
instance from a parent pathname string
and a child pathname string.
If path
is null
then the new
DSFile
instance is created as if by invoking the
single-argument DSFile
constructor on the given
name
pathname string.
Otherwise the path
pathname string is taken to denote
a directory, and the name
pathname string is taken to
denote either a directory or a file. If the name
pathname
string is absolute then it is converted into a relative pathname in a
system-dependent way. If path
is the empty string then
the new DSFile
instance is created by converting
name
into an abstract pathname and resolving the result
against the current working directory. Otherwise each pathname
string is converted into an abstract pathname and the child abstract
pathname is resolved against the parent.
path
- the directory pathnamename
- the file pathnamenull
public DSFile(File dir, String name)
DSFile
instance from a parent abstract
pathname and a child pathname string.
If dir
is null
then the new
DSFile
instance is created as if by invoking the
single-argument DSFile
constructor on the given
name
pathname string.
Otherwise the dir
abstract pathname is taken to
denote a directory, and the name
pathname string is taken
to denote either a directory or a file. If the name
pathname string is absolute then it is converted into a relative
pathname in a system-dependent way. If dir
is the empty
abstract pathname then the new DSFile
instance is created by
converting name
into an abstract pathname and resolving
the result against the current working directory. Otherwise each
pathname string is converted into an abstract pathname and the child
abstract pathname is resolved against the parent.
dir
- the directoryname
- the file pathnamenull
Method Detail |
public void setUserPermissions(int perms) throws IOException
Bit 1 = Write
Bit 2 = Read
Bit 0 = Execute
Set the bit to grant that permission, clear it to deny.
perms
- the new user/owner permissionsgetUserPermissions()
public int getUserPermissions() throws FileNotFoundException
Bit 1 = Write
Bit 2 = Read
Bit 0 = Execute
If the bit is set, that permission is granted, otherwise it is denied.
setUserPermissions(int)
public void setOtherPermissions(int perms) throws IOException
Bit 1 = Write
Bit 2 = Read
Bit 0 = Execute
Set the bit to grant that permission, clear it to deny.
perms
- the new other permissionsgetOtherPermissions()
public int getOtherPermissions() throws FileNotFoundException
Bit 1 = Write
Bit 2 = Read
Bit 0 = Execute
If the bit is set, that permission is granted, otherwise it is denied.
setOtherPermissions(int)
public void setUser(byte uid) throws IOException
uid
- the ID of the new usergetUser()
,
TINIOS.getCurrentUID()
,
TINIOS.getUserNameByUID(byte)
,
TINIOS.getUIDByUserName(String)
public int getUser() throws FileNotFoundException
setUser(byte)
,
TINIOS.getCurrentUID()
,
TINIOS.getUserNameByUID(byte)
,
TINIOS.getUIDByUserName(String)
public boolean canExec()
true
if the application can execute this file,
false
otherwiseexecuteFile(InputStream,OutputStream,OutputStream,String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String,Process)
,
executeFile()
public int executeFile() throws IOException
java.lang.Runtime
class to start new processes. System.in
, System.out
, and
System.err
of the calling process are used for the new process's streams.
This call will block until the new process finishes.canExec()
method returns falsecanExec()
,
executeFile(InputStream,OutputStream,OutputStream,String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String,Process)
public void touch() throws IOException
public boolean listLong(OutputStream out, boolean unixStyle) throws IOException
out
- the output stream the listing will be sent tounixStyle
- whether the Un*x format should be usedpublic static byte[] buildAbsolutePath(String parent, String name)
Byte 0-3 = The offset into the array where the name begins (LSB, xx, xx, MSB).
Byte 4-7 = The length of the name stored in the array (LSB, xx, xx, MSB).
Byte 8-x = The data holding the ASCII name of the file. There may be extra bytes preceding or following the actual data. Use the first eight bytes of the array to determine which bytes to use.
parent
- the directory or path of the filename
- the file namepublic int executeFile(InputStream stdin, OutputStream stdout, OutputStream stderr, String[] args, boolean foreground, String processName) throws IOException
java.lang.Runtime
class to start new processes.stdin
- the stream that will become the new
process's System.in
stdout
- the stream that will become the new
process's System.out
stderr
- the stream that will become the new
process's System.err
args
- the arguments that will be passed to the
applications main(String[])
methodforeground
- whether this method should block until the new process finishesprocessName
- the name of the new processcanExec()
method returns falsecanExec()
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String,Process)
,
executeFile()
public int executeFile(InputStream stdin, OutputStream stdout, OutputStream stderr, String[] args, String[] env, boolean foreground, String processName) throws IOException
java.lang.Runtime
class to start new processes.stdin
- the stream that will become the new
process's System.in
stdout
- the stream that will become the new
process's System.out
stderr
- the stream that will become the new
process's System.err
args
- the arguments that will be passed to the
applications main(String[])
methodenv
- the environment that will be added to the process's
System propertiesforeground
- whether this method should block until the new process finishesprocessName
- the name of the new processcanExec()
method returns falsecanExec()
,
executeFile(InputStream,OutputStream,OutputStream,String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String,Process)
,
executeFile()
public int executeFile(InputStream stdin, OutputStream stdout, OutputStream stderr, String[] args, String[] env, boolean foreground, String processName, Process procObj) throws IOException
java.lang.Runtime
class to start new processes.stdin
- the stream that will become the new
process's System.in
stdout
- the stream that will become the new
process's System.out
stderr
- the stream that will become the new
process's System.err
args
- the arguments that will be passed to the
applications main(String[])
methodenv
- the environment that will be added to the process's
System propertiesforeground
- whether this method should block until the new process finishesprocessName
- the name of the new processprocObj
- the Process object to associate with the new processcanExec()
method returns falsecanExec()
,
executeFile(InputStream,OutputStream,OutputStream,String[],String[],boolean,String)
,
executeFile(InputStream,OutputStream,OutputStream,String[],boolean,String)
,
executeFile()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |