|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An abstract representation of a file in a custom file system.
This class is roughly comparable to the Java class File
.
Just as with the File
class, the constructor for this class should
be fairly fast because the Stylus Studio Input/Output framework creates
and destroys them frequently, even though the actual file may never be read.
Method Summary | |
void |
close()
Close and release any resources held by this StylusFile object. |
void |
copyFromFile(String fileName)
Copy the contents of a named file to this StylusFile . |
void |
copyToFile(String fileName)
Copy the contents of this StylusFile to a named file. |
InputStream |
getInputStream()
Return a stream which can be used to read data from this StylusFile . |
long |
getModifiedTime()
Return the time that the file denoted by this StylusFile was last modified. |
String |
getName()
Return the file name of this StylusFile . |
OutputStream |
getOutputStream()
Return an output stream which can be used to write data to this StylusFile . |
String |
getPath()
Return the pathname of this StylusFile . |
boolean |
isDirectory()
Return whether the file denoted by this StylusFile is a directory. |
boolean |
isDots()
Return true if getName() would return "." or "..". |
boolean |
isHidden()
Return true if this StylusFile denotes a "Hidden" file. |
boolean |
isLink()
Return true if this StylusFile denotes a link or shortcut file. |
boolean |
isReadOnly()
Return whether the file represented by this StylusFile is read-only. |
long |
length()
Return the number of bytes in this StylusFile . |
StylusFile[] |
listFiles()
Return an array of StylusFile objects denoting the files in the directory
denoted by this StylusFile . |
Method Detail |
public StylusFile[] listFiles()
StylusFile
objects denoting the files in the directory
denoted by this StylusFile
.
public boolean isDirectory()
StylusFile
is a directory.
true
if the file is a directory.public boolean isReadOnly()
StylusFile
is read-only.
true
if the file is read-only.public void copyFromFile(String fileName) throws IOException
StylusFile
.
The Stylus Studio Input/Output framework will call this method
to write data to the physical file denoted by this StylusFile
.
Stylus Studio first creates a temp file containing
the binary data to be written, then calls copyFromFile to
do the final write operation.
copyFromFile must read the temp file (a FileInputStream is suitable)
and write the data to the physical file denoted by this StylusFile
.
copyFromFile must close the temp file, but the Stylus Studio Input/Output
framework will take care of deleting it.
fileName
- the name of the input file.
IOException
public void copyToFile(String fileName) throws IOException
StylusFile
to a named file.
The Stylus Studio Input/Output framework will call this method to read data
from the physical file denoted by this StylusFile
.
copyToFile must read the data from the physical file denoted by this
StylusFile
and write it to the named output file. The simplest
way to do this is with the static helper method
StylusFileHelpers.copyToFile
.
fileName
- the name of the output file.
IOException
StylusFileHelpers.copyToFile(StylusFile, String)
public long getModifiedTime()
StylusFile
was last modified.
The actual value is not significant, but when a file is modified, the
getModifiedTime should increase monotonically. The value is used by
Stylus Studio to detect when a file has changed.
public InputStream getInputStream() throws IOException
StylusFile
.
The Stylus Studio Input/Output framework will subsequently use the
read methods of the returned InputStream to read the data, and will,
eventually, call the close() method of the InputStream as well as
StylusFile.close()
.
IOException
public OutputStream getOutputStream() throws IOException
StylusFile
.
The Stylus Studio Input/Output framework will subsequently write bytes
to the OutputStream, which must write them to the physical file denoted
by this StylusFile
. After Stylus Studio has written all the data, it will
call the close() method of the OutputStream as well as
StylusFile.close()
.
IOException
public void close()
StylusFile
object.
This method may be called repeatedly for the same StylusFile
object
public String getName()
StylusFile
.
This is just the last name in the pathname's name sequence.
StylusFile
.public String getPath()
StylusFile
.
This is the complete pathname without the scheme:// prefix
It should always begin with a /, and all \ characters (if any) should be
converted to / characters.
StylusFile
.public long length()
StylusFile
.
public boolean isDots()
true
if this pathname ends with "." or "..".public boolean isHidden()
StylusFile
denotes a "Hidden" file.
true
if it is a hidden file.public boolean isLink()
StylusFile
denotes a link or shortcut file.
true
if it is a link or shortcut.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |