Package org.eclipse.core.resources

# Class ResourceAttributes

java.lang.Object
org.eclipse.core.resources.ResourceAttributes

public class ResourceAttributes extends Object
This class represents platform specific attributes of files. Any attributes can be added, but only the attributes that are supported by the platform will be used. These methods do not set the attributes in the file system.

Since:
  3.1
Author:
  Red Hat Incorporated
See Also:
  - `IResource.getResourceAttributes()`
  - `IResource.setResourceAttributes(ResourceAttributes)`
Restriction:
  This class is not intended to be subclassed by clients.

## Constructor Summary

Constructors
Constructor
Description
`ResourceAttributes()`
Creates a new instance of `ResourceAttributes`.

## Method Summary

Modifier and Type
Method
Description
`static ResourceAttributes`
`fromFile(File file)`
Creates a new resource attributes instance with attributes taken from the specified file in the file system.
`boolean`
`isArchive()`
Returns whether this ResourceAttributes object is marked archive.
`boolean`
`isExecutable()`
Returns whether this ResourceAttributes object is marked executable.
`boolean`
`isHidden()`
Returns whether this ResourceAttributes object is marked hidden.
`boolean`
`isReadOnly()`
Returns whether this ResourceAttributes object is marked read only.
`boolean`
`isSet(int mask)`
Returns whether this ResourceAttributes object has the given mask set.
`boolean`
`isSymbolicLink()`
Returns whether this ResourceAttributes object is marked as symbolic link.
`void`
`set(int mask, boolean value)`
Clears all of the bits indicated by the mask.
`void`
`setArchive(boolean archive)`
Sets or unsets whether this ResourceAttributes object is marked archive.
`void`
`setExecutable(boolean executable)`
Sets or unsets whether this ResourceAttributes object is marked executable.
`void`
`setHidden(boolean hidden)`
Sets or unsets whether this ResourceAttributes object is marked hidden
`void`
`setReadOnly(boolean readOnly)`
Sets or unsets whether this ResourceAttributes object is marked read only.
`void`
`setSymbolicLink(boolean symLink)`
Sets or unsets whether this ResourceAttributes object is marked as symbolic link.
`String`
`toString()`
Returns a string representation of the attributes, suitable for debugging purposes only.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ResourceAttributes

public ResourceAttributes()
Creates a new instance of `ResourceAttributes`.

## Method Details

### fromFile

public static ResourceAttributes fromFile(File file)
Creates a new resource attributes instance with attributes taken from the specified file in the file system. If the specified file does not exist or is not accessible, this method has the same effect as calling the default constructor.

Parameters:
  `file` - The file to get attributes from
Returns:
  A resource attributes object

### isArchive

public boolean isArchive()
Returns whether this ResourceAttributes object is marked archive.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_ARCHIVE`.

Returns:
  `true` if this resource is marked archive, `false` otherwise
See Also:
  - `setArchive(boolean)`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_ARCHIVE`

### isExecutable

public boolean isExecutable()
Returns whether this ResourceAttributes object is marked executable.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_EXECUTABLE`.

Returns:
  `true` if this resource is marked executable, `false` otherwise
See Also:
  - `setExecutable(boolean)`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_EXECUTABLE`

### isHidden

public boolean isHidden()
Returns whether this ResourceAttributes object is marked hidden.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_HIDDEN`.

Returns:
  `true` if this resource is marked hidden, `false` otherwise
Since:
  3.2
See Also:
  - `setHidden(boolean)`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_HIDDEN`

### isReadOnly

public boolean isReadOnly()
Returns whether this ResourceAttributes object is marked read only.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_READ_ONLY`.

Returns:
  `true` if this resource is marked as read only, `false` otherwise
See Also:
  - `setReadOnly(boolean)`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_READ_ONLY`

### isSymbolicLink

public boolean isSymbolicLink()
Returns whether this ResourceAttributes object is marked as symbolic link.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_SYMLINK`.

Returns:
  `true` if this resource is marked as symbolic link, `false` otherwise
Since:
  3.4
See Also:
  - `setSymbolicLink(boolean)`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_SYMLINK`

### setArchive

public void setArchive(boolean archive)
Sets or unsets whether this ResourceAttributes object is marked archive.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_ARCHIVE`.

Parameters:
  `archive` - `true` to set it to be archive, `false` to unset
See Also:
  - `isArchive()`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_ARCHIVE`

### set

public void set(int mask, boolean value)
Clears all of the bits indicated by the mask.

Restriction:
  This method is not intended to be referenced by clients.
Restriction:
  This method is not intended to be re-implemented or extended by clients.

### isSet

public boolean isSet(int mask)
Returns whether this ResourceAttributes object has the given mask set.

Restriction:
  This method is not intended to be referenced by clients.
Restriction:
  This method is not intended to be re-implemented or extended by clients.

### setExecutable

public void setExecutable(boolean executable)
Sets or unsets whether this ResourceAttributes object is marked executable.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_EXECUTABLE`.

Parameters:
  `executable` - `true` to set it to be executable, `false` to unset
See Also:
  - `isExecutable()`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_EXECUTABLE`

### setHidden

public void setHidden(boolean hidden)
Sets or unsets whether this ResourceAttributes object is marked hidden

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_HIDDEN`.

Parameters:
  `hidden` - `true` to set it to be marked hidden, `false` to unset
Since:
  3.2
See Also:
  - `isHidden()`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_HIDDEN`

### setReadOnly

public void setReadOnly(boolean readOnly)
Sets or unsets whether this ResourceAttributes object is marked read only.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_READ_ONLY`.

Parameters:
  `readOnly` - `true` to set it to be marked read only, `false` to unset
See Also:
  - `isReadOnly()`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_READ_ONLY`

### setSymbolicLink

public void setSymbolicLink(boolean symLink)
Sets or unsets whether this ResourceAttributes object is marked as symbolic link.

This attribute is used only on file systems supporting `EFS.ATTRIBUTE_SYMLINK`.

Parameters:
  `symLink` - `true` to set it to be marked as symbolic link, `false` to unset
Since:
  3.4
See Also:
  - `isSymbolicLink()`
  - `IFileSystem.attributes()`
  - `EFS.ATTRIBUTE_SYMLINK`

### toString

public String toString()
Returns a string representation of the attributes, suitable for debugging purposes only.

Overrides:
  `toString` in class `Object`