|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.tools.resources.AttributeHolder org.w3c.tools.resources.Resource org.w3c.tools.resources.FramedResource org.w3c.tools.resources.FileResource
public class FileResource
A simple file resource.
Field Summary | |
---|---|
protected static int |
ATTR_FILE_BACKUP
Attribute index - The index for the backup flag |
protected static int |
ATTR_FILE_LENGTH
Attribute index - The index for the content length attribute. |
protected static int |
ATTR_FILENAME
Attributes index - The filename attribute. |
protected static int |
ATTR_FILESTAMP
Attribute index - The date at which we last checked the file content. |
protected java.io.File |
file
The file we refer to. |
Fields inherited from class org.w3c.tools.resources.FramedResource |
---|
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener |
Fields inherited from class org.w3c.tools.resources.Resource |
---|
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id |
Fields inherited from class org.w3c.tools.resources.AttributeHolder |
---|
attributes, values |
Constructor Summary | |
---|---|
FileResource()
|
Method Summary | |
---|---|
long |
checkContent()
Check this file content, and update attributes if needed. |
java.io.File |
getBackupFile()
Get the name of the backup file for this resource. |
boolean |
getBackupFlag()
Get the backup flag, create a backup file when content change if true. |
java.io.File |
getFile()
Get this file resource file name. |
int |
getFileLength()
Get this file length |
java.lang.String |
getFilename()
Get this resource filename attribute. |
long |
getFileStamp()
Get the date at which we last examined the file. |
void |
initialize(java.lang.Object[] values)
Initialize the FileResource instance. |
boolean |
newContent(java.io.InputStream in)
Save the given stream as the underlying file content. |
void |
setValue(int idx,
java.lang.Object value)
Set some of this resource attribute. |
void |
updateAttributes()
Update our computed attributes. |
void |
updateFileAttributes()
Update the file related attributes. |
boolean |
verify()
Is that resource still wrapping an existing file ? If the underlying file has disappeared |
Methods inherited from class org.w3c.tools.resources.Resource |
---|
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, initialize, isInitialized, isUnloaded, pickleValues, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue |
Methods inherited from class org.w3c.tools.resources.AttributeHolder |
---|
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int ATTR_FILENAME
protected static int ATTR_FILESTAMP
protected static int ATTR_FILE_LENGTH
protected static int ATTR_FILE_BACKUP
protected java.io.File file
Constructor Detail |
---|
public FileResource()
Method Detail |
---|
public java.lang.String getFilename()
public int getFileLength()
public long getFileStamp()
public boolean getBackupFlag()
public java.io.File getBackupFile()
public boolean newContent(java.io.InputStream in) throws java.io.IOException
~
file.
in
- The input stream to use as the resource entity.
java.io.IOException
- If dumping the content failed.public long checkContent()
public void setValue(int idx, java.lang.Object value)
setValue
in class FramedResource
idx
- The index of the attribute to modify.value
- The new attribute value.public java.io.File getFile()
InvalidParentException
- If no parent is available,
and then the FileReource is unable to get its file.public boolean verify() throws MultipleLockException
MultipleLockException
- When the
resource try to delete itself (because there is no more file)public void updateFileAttributes()
public void updateAttributes()
updateAttributes
in class Resource
public void initialize(java.lang.Object[] values)
initialize
in class FramedResource
values
- Default attribute values.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |