org.dvb.io.persistent
Class FileAttributes

java.lang.Object
  extended byorg.dvb.io.persistent.FileAttributes

public class FileAttributes
extends java.lang.Object

This class encapsulates the attributes of a file stored in persistent storage. The default attributes for a file are low priority, owner read / write only permissions and null expiration date.


Field Summary
static int PRIORITY_HIGH
          Value for use as a file priority.
static int PRIORITY_LOW
          Value for use as a file priority.
static int PRIORITY_MEDIUM
          Value for use as a file priority.
 
Constructor Summary
FileAttributes(java.util.Date expiration_date, FileAccessPermissions p, int priority)
          Constructor.
 
Method Summary
 java.util.Date getExpirationDate()
          Returns the expiration date.
static FileAttributes getFileAttributes(java.io.File f)
          Get the attributes of a file.
 FileAccessPermissions getPermissions()
          Returns the file access permissions
 int getPriority()
          Returns the priority to use in persistent storage
 void setExpirationDate(java.util.Date d)
          Sets the expiration date.
static void setFileAttributes(FileAttributes p, java.io.File f)
          Associate a set of file attributes with a file.
 void setPermissions(FileAccessPermissions p)
          Sets the file access permissions.
 void setPriority(int priority)
          Sets the priority to use in persistent storage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY_LOW

public static final int PRIORITY_LOW
Value for use as a file priority.

See Also:
Constant Field Values

PRIORITY_MEDIUM

public static final int PRIORITY_MEDIUM
Value for use as a file priority.

See Also:
Constant Field Values

PRIORITY_HIGH

public static final int PRIORITY_HIGH
Value for use as a file priority.

See Also:
Constant Field Values
Constructor Detail

FileAttributes

public FileAttributes(java.util.Date expiration_date,
                      FileAccessPermissions p,
                      int priority)
Constructor.

Parameters:
expiration_date - an expiration date or null
p - the access permissions to use
priority - the priority to use in persistent storage
Method Detail

getExpirationDate

public java.util.Date getExpirationDate()
Returns the expiration date. It will return the value used by the platform, which need not be the same as the value set.

Returns:
the expiration date

setExpirationDate

public void setExpirationDate(java.util.Date d)
Sets the expiration date. This field is a hint to the platform to identify the date after which a file is no longer useful as percieved by the application. The platform may choose to use a different date than the one given as a parameter.

Parameters:
d - the expiration date

getPermissions

public FileAccessPermissions getPermissions()
Returns the file access permissions

Returns:
the file access permissions

setPermissions

public void setPermissions(FileAccessPermissions p)
Sets the file access permissions.

Parameters:
p - the file access permissions

getPriority

public int getPriority()
Returns the priority to use in persistent storage

Returns:
the priority

setPriority

public void setPriority(int priority)
Sets the priority to use in persistent storage

Parameters:
priority - the priority to set

setFileAttributes

public static void setFileAttributes(FileAttributes p,
                                     java.io.File f)
                              throws java.io.IOException
Associate a set of file attributes with a file.

Parameters:
p - the file attributes to use
f - the file to use
Throws:
java.lang.SecurityException - if the application is either denied access to the file or directories needed to reach the file by security policy or is not authorised to modify the attributes of the file.
java.io.IOException - if access to the file fails due to an IO error or if the file reference is not to a valid location in persistent storage

getFileAttributes

public static FileAttributes getFileAttributes(java.io.File f)
                                        throws java.io.IOException
Get the attributes of a file.

Parameters:
f - the file to use
Returns:
a copy of the attributes of a file
Throws:
java.lang.SecurityException - if the application is denied access to the file or to directories needed to reach the file by security policy
java.io.IOException - if access to the file fails due to an IO error or if the file reference is not to a valid location in persistent storage