KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > filesystem > IFileInfo


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API
11  *******************************************************************************/

12 package org.eclipse.core.filesystem;
13
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 /**
17  * A file info is a simple structure holding information about a file or directory.
18  * The information contained here is static; changes to this object will
19  * not cause corresponding changes to any file on disk, and changes to files
20  * on disk are not reflected in this object. At best, an IFileInfo represents a snapshot
21  * of the state of a file at a particular moment in time.
22  * <p>
23  * This interface is not intended to be implemented by clients. File store
24  * implementations should use the concrete class {@link org.eclipse.core.filesystem.provider.FileStore}
25  * </p>
26  *
27  * @see IFileStore#fetchInfo(int, IProgressMonitor)
28  * @see IFileStore#putInfo(IFileInfo, int, IProgressMonitor)
29  * @since org.eclipse.core.filesystem 1.0
30  */

31 public interface IFileInfo extends Comparable JavaDoc, Cloneable JavaDoc {
32
33     /**
34      * Returns whether this file or directory exists.
35      *
36      * @return <code>true</code> if this file exists, and <code>false</code>
37      * otherwise.
38      */

39     public abstract boolean exists();
40
41     /**
42      * Returns the value of the specified attribute for this file. The attribute
43      * must be one of the <code>EFS#ATTRIBUTE_*</code>
44      * constants. Returns <code>false</code> if this file does not exist,
45      * could not be accessed, or the provided attribute does not apply to this
46      * file system.
47      *
48      * @param attribute The attribute to retrieve the value for
49      * @return the value of the specified attribute for this file.
50      * @see IFileSystem#attributes()
51      */

52     public abstract boolean getAttribute(int attribute);
53
54     /**
55     * Returns the value of the specified attribute for this file. The attribute
56      * must be one of the <code>EFS#ATTRIBUTE_*</code>
57      * constants. Returns <code>null</code> if this file does not exist,
58      * could not be accessed, or the provided attribute does not apply to this
59      * file system.
60      *
61      * @param attribute The kind of attribute to return. Currently only
62      * {@link EFS#ATTRIBUTE_LINK_TARGET} is supported.
63      * @return the value of the extended String attribute for this file.
64      * @see IFileSystem#attributes()
65      * @since org.eclipse.core.filesystem 1.1
66      */

67     public abstract String JavaDoc getStringAttribute(int attribute);
68
69     /**
70      * Returns the last modified time for this file, or {@link EFS#NONE}
71      * if the file does not exist or the last modified time could not be computed.
72      * <p>
73      * The time is represented as the number of Universal Time (UT)
74      * milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
75      * </p>
76      *
77      * @return the last modified time for this file, or {@link EFS#NONE}
78      */

79     public abstract long getLastModified();
80
81     /**
82      * Returns the length of this file, or {@link EFS#NONE}
83      * if the file does not exist, is a directory, or the length could not be computed.
84      *
85      * @return the length of this file, or {@link EFS#NONE}
86      */

87     public abstract long getLength();
88
89     /**
90      * Returns the name of this file.
91      *
92      * @return the name of this file.
93      */

94     public abstract String JavaDoc getName();
95
96     /**
97      * Returns whether this file is a directory, or <code>false</code> if this
98      * file does not exist.
99      *
100      * @return <code>true</code> if this file is a directory, and <code>false</code>
101      * otherwise.
102      */

103     public abstract boolean isDirectory();
104
105     /**
106      * Sets the value of the specified attribute for this file info. The attribute
107      * must be one of the <code>EFS#ATTRIBUTE_*</code> constants.
108      * Note that not all attributes are applicable in a given file system.
109      * </p>
110      * <p>
111      * Users must call {@link IFileStore#putInfo(IFileInfo, int, IProgressMonitor)}
112      * before changes made to this info take effect in an underlying file.
113      * </p>
114      *
115      * @param attribute The attribute to set the value for
116      * @param value the value of the specified attribute for this file.
117      * @see IFileSystem#attributes()
118      */

119     public abstract void setAttribute(int attribute, boolean value);
120
121     /**
122      * Sets the last modified time for this file. A value of {@link EFS#NONE}
123      * indicates the file does not exist or the last modified time could not be computed.
124      * <p>
125      * Users must call {@link IFileStore#putInfo(IFileInfo, int, IProgressMonitor)}
126      * before changes made to this info take effect in an underlying file.
127      * </p>
128      *
129      * @param time the last modified time for this file, or {@link EFS#NONE}
130      */

131     public abstract void setLastModified(long time);
132 }
Popular Tags