KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > resources > IFileState


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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  *******************************************************************************/

11 package org.eclipse.core.resources;
12
13 import java.io.InputStream JavaDoc;
14 import org.eclipse.core.runtime.*;
15
16 /**
17  * A previous state of a file stored in the workspace's local history.
18  * <p>
19  * Certain methods for updating, deleting, or moving a file cause the
20  * "before" contents of the file to be copied to an internal area of the
21  * workspace called the <b>local history area</b> thus providing
22  * a limited history of earlier states of a file.
23  * </p>
24  * <p>
25  * Moving or copying a file will cause a copy of its local history to appear
26  * at the new location as well as at the original location. Subsequent
27  * changes to either file will only affect the local history of the file
28  * changed. Deleting a file and creating another one at the
29  * same path does not affect the history. If the original file had
30  * history, that same history will be available for the new one.
31  * </p>
32  * <p>
33  * The local history does not track resource properties.
34  * File states are volatile; the platform does not guarantee that a
35  * certain state will always be in the local history.
36  * </p>
37  * <p>
38  * This interface is not intended to be implemented by clients.
39  * </p>
40  * <p>
41  * File state objects implement the <code>IAdaptable</code> interface;
42  * extensions are managed by the platform's adapter manager.
43  * </p>
44  *
45  * @see IFile
46  * @see IStorage
47  * @see Platform#getAdapterManager()
48  */

49 public interface IFileState extends IEncodedStorage, IAdaptable {
50     /**
51      * Returns whether this file state still exists in the local history.
52      *
53      * @return <code>true</code> if this state exists, and <code>false</code>
54      * if it does not
55      */

56     public boolean exists();
57
58     /**
59      * Returns an open input stream on the contents of this file state.
60      * This refinement of the corresponding
61      * <code>IStorage</code> method returns an open input stream
62      * on the contents this file state represents.
63      * The client is responsible for closing the stream when finished.
64      *
65      * @return an input stream containing the contents of the file
66      * @exception CoreException if this method fails. Reasons include:
67      * <ul>
68      * <li> This state does not exist.</li>
69      * </ul>
70      */

71     public InputStream JavaDoc getContents() throws CoreException;
72
73     /**
74      * Returns the full path of this file state.
75      * This refinement of the corresponding <code>IStorage</code>
76      * method specifies that <code>IFileState</code>s always have a
77      * path and that path is the full workspace path of the file represented by this state.
78      *
79      * @see IResource#getFullPath()
80      * @see IStorage#getFullPath()
81      */

82     public IPath getFullPath();
83
84     /**
85      * Returns the modification time of the file. If you create a file at
86      * 9:00 and modify it at 11:00, the file state added to the history
87      * at 11:00 will have 9:00 as its modification time.
88      * <p>
89      * Note that is used only to give the user a general idea of how
90      * old this file state is.
91      *
92      * @return the time of last modification, in milliseconds since
93      * January 1, 1970, 00:00:00 GMT.
94      */

95     public long getModificationTime();
96
97     /**
98      * Returns the name of this file state.
99      * This refinement of the corresponding <code>IStorage</code>
100      * method specifies that <code>IFileState</code>s always have a
101      * name and that name is equivalent to the last segment of the full path
102      * of the resource represented by this state.
103      *
104      * @see IResource#getName()
105      * @see IStorage#getName()
106      */

107     public String JavaDoc getName();
108
109     /**
110      * Returns whether this file state is read-only.
111      * This refinement of the corresponding
112      * <code>IStorage</code> method restricts <code>IFileState</code>s to
113      * always be read-only.
114      *
115      * @see IStorage
116      */

117     public boolean isReadOnly();
118 }
119
Popular Tags