|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.filesystems.DefaultAttributes
Implementation of AbstractFileSystem.Attr
using a special file
in each folder for holding attributes.
It needs to hide
the file from the rest of system, so it also implements
AbstractFileSystem.List
to exclude the file from the children list
(it can then serve to filter a plain list implementation).
Description of format of special file ilustrates best DTD file that is showed in next lines:
Field Summary | |
static String |
ATTR_EXT
Deprecated. does not handle XML attributes |
static String |
ATTR_NAME
Deprecated. does not handle XML attributes |
static String |
ATTR_NAME_EXT
Deprecated. does not handle XML attributes |
Constructor Summary | |
|
DefaultAttributes(AbstractFileSystem.Info info,
AbstractFileSystem.Change change,
AbstractFileSystem.List list)
Constructor. |
protected |
DefaultAttributes(AbstractFileSystem.Info info,
AbstractFileSystem.Change change,
AbstractFileSystem.List list,
String fileName)
Constructor. |
Method Summary | |
Enumeration |
attributes(String name)
Get all file attribute names for the file. |
String[] |
children(String f)
Get the children list, filtering out the special attributes file. |
void |
deleteAttributes(String name)
Called when a file is deleted, to also delete its attributes. |
Object |
readAttribute(String name,
String attrName)
Get the file attribute with the specified name. |
void |
renameAttributes(String oldName,
String newName)
Called when a file is renamed, to appropriately update its attributes. |
void |
writeAttribute(String name,
String attrName,
Object value)
Set the file attribute with the specified name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String ATTR_NAME
public static final String ATTR_EXT
public static final String ATTR_NAME_EXT
Constructor Detail |
public DefaultAttributes(AbstractFileSystem.Info info, AbstractFileSystem.Change change, AbstractFileSystem.List list)
info
- file object information to usechange
- file change hooks to uselist
- list to filter (can be null
, but then this object cannot work as a list)protected DefaultAttributes(AbstractFileSystem.Info info, AbstractFileSystem.Change change, AbstractFileSystem.List list, String fileName)
info
- file object information to usechange
- file change hooks to uselist
- list to filter (can be null
, but then this object cannot work as a list)fileName
- Method Detail |
public String[] children(String f)
null
AbstractFileSystem.List
in the constructor for this to work. If you did not, the rest of the class will work
fine, but this method should not be called and this object should not be used
as a List
implementation.
children
in interface AbstractFileSystem.List
f
- the folder, by name; e.g. top/next/afterthat
file.ext
(no path)public Object readAttribute(String name, String attrName)
AbstractFileSystem.Attr
readAttribute
in interface AbstractFileSystem.Attr
name
- the fileattrName
- name of the attribute
null
if the attribute is unset (or could not be properly restored for some reason)public void writeAttribute(String name, String attrName, Object value) throws IOException
AbstractFileSystem.Attr
writeAttribute
in interface AbstractFileSystem.Attr
name
- the fileattrName
- name of the attributevalue
- new value or null
to clear the attribute. Must be serializable, although particular filesystems may or may not use serialization to store attribute values.
IOException
- if the attribute cannot be set. If serialization is used to store it, this may in fact be a subclass such as NotSerializableException
.public Enumeration attributes(String name)
AbstractFileSystem.Attr
attributes
in interface AbstractFileSystem.Attr
name
- the file
public void renameAttributes(String oldName, String newName)
AbstractFileSystem.Attr
renameAttributes
in interface AbstractFileSystem.Attr
oldName
- old name of the filenewName
- new name of the filepublic void deleteAttributes(String name)
AbstractFileSystem.Attr
deleteAttributes
in interface AbstractFileSystem.Attr
name
- name of the file
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |