|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IFile
Files are leaf resources which contain data. The contents of a file resource is stored as a file in the local file system.
Files, like folders, may exist in the workspace but not be local; non-local file resources serve as place-holders for files whose content and properties have not yet been fetched from a repository.
Files implement the IAdaptable
interface;
extensions are managed by the platform's adapter manager.
Platform.getAdapterManager()
Field Summary | |
---|---|
static int |
ENCODING_ISO_8859_1
Deprecated. see getEncoding for details |
static int |
ENCODING_UNKNOWN
Deprecated. see getEncoding for details |
static int |
ENCODING_US_ASCII
Deprecated. see getEncoding for details |
static int |
ENCODING_UTF_16
Deprecated. see getEncoding for details |
static int |
ENCODING_UTF_16BE
Deprecated. see getEncoding for details |
static int |
ENCODING_UTF_16LE
Deprecated. see getEncoding for details |
static int |
ENCODING_UTF_8
Deprecated. see getEncoding for details |
Fields inherited from interface org.eclipse.core.resources.IResource |
---|
ALLOW_MISSING_LOCAL, ALWAYS_DELETE_PROJECT_CONTENT, AVOID_NATURE_CONFIG, BACKGROUND_REFRESH, CHECK_ANCESTORS, DEPTH_INFINITE, DEPTH_ONE, DEPTH_ZERO, DERIVED, FILE, FOLDER, FORCE, HIDDEN, KEEP_HISTORY, NEVER_DELETE_PROJECT_CONTENT, NONE, NULL_STAMP, PROJECT, REPLACE, ROOT, SHALLOW, TEAM_PRIVATE |
Method Summary | |
---|---|
void |
appendContents(java.io.InputStream source,
boolean force,
boolean keepHistory,
org.eclipse.core.runtime.IProgressMonitor monitor)
Appends the entire contents of the given stream to this file. |
void |
appendContents(java.io.InputStream source,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Appends the entire contents of the given stream to this file. |
void |
create(java.io.InputStream source,
boolean force,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new file resource as a member of this handle's parent resource. |
void |
create(java.io.InputStream source,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new file resource as a member of this handle's parent resource. |
void |
createLink(org.eclipse.core.runtime.IPath localLocation,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new file resource as a member of this handle's parent resource. |
void |
createLink(java.net.URI location,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates a new file resource as a member of this handle's parent resource. |
void |
delete(boolean force,
boolean keepHistory,
org.eclipse.core.runtime.IProgressMonitor monitor)
Deletes this file from the workspace. |
java.lang.String |
getCharset()
Returns the name of a charset to be used when decoding the contents of this file into characters. |
java.lang.String |
getCharset(boolean checkImplicit)
Returns the name of a charset to be used when decoding the contents of this file into characters. |
java.lang.String |
getCharsetFor(java.io.Reader reader)
Returns the name of a charset to be used to encode the given contents when saving to this file. |
org.eclipse.core.runtime.content.IContentDescription |
getContentDescription()
Returns a description for this file's current contents. |
java.io.InputStream |
getContents()
Returns an open input stream on the contents of this file. |
java.io.InputStream |
getContents(boolean force)
This refinement of the corresponding IStorage method
returns an open input stream on the contents of this file. |
int |
getEncoding()
Deprecated. use IFile#getCharset instead |
org.eclipse.core.runtime.IPath |
getFullPath()
Returns the full path of this file. |
IFileState[] |
getHistory(org.eclipse.core.runtime.IProgressMonitor monitor)
Returns a list of past states of this file known to this workspace. |
java.lang.String |
getName()
Returns the name of this file. |
boolean |
isReadOnly()
Returns whether this file is read-only. |
void |
move(org.eclipse.core.runtime.IPath destination,
boolean force,
boolean keepHistory,
org.eclipse.core.runtime.IProgressMonitor monitor)
Moves this resource to be at the given location. |
void |
setCharset(java.lang.String newCharset)
Deprecated. Replaced by setCharset(String, IProgressMonitor) which
is a workspace operation and reports changes in resource deltas. |
void |
setCharset(java.lang.String newCharset,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the charset for this file. |
void |
setContents(IFileState source,
boolean force,
boolean keepHistory,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the contents of this file to the bytes in the given file state. |
void |
setContents(IFileState source,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the contents of this file to the bytes in the given file state. |
void |
setContents(java.io.InputStream source,
boolean force,
boolean keepHistory,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the contents of this file to the bytes in the given input stream. |
void |
setContents(java.io.InputStream source,
int updateFlags,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the contents of this file to the bytes in the given input stream. |
Methods inherited from interface org.eclipse.core.runtime.jobs.ISchedulingRule |
---|
contains, isConflicting |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Field Detail |
---|
static final int ENCODING_UNKNOWN
getEncoding()
,
Constant Field Valuesstatic final int ENCODING_US_ASCII
getEncoding()
,
Constant Field Valuesstatic final int ENCODING_ISO_8859_1
getEncoding()
,
Constant Field Valuesstatic final int ENCODING_UTF_8
getEncoding()
,
Constant Field Valuesstatic final int ENCODING_UTF_16BE
getEncoding()
,
Constant Field Valuesstatic final int ENCODING_UTF_16LE
getEncoding()
,
Constant Field Valuesstatic final int ENCODING_UTF_16
getEncoding()
,
Constant Field ValuesMethod Detail |
---|
void appendContents(java.io.InputStream source, boolean force, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
appendContents(source, (keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's content have been changed.
This method is long-running; progress and cancelation are provided by the given progress monitor.
source
- an input stream containing the new contents of the fileforce
- a flag controlling how to deal with resources that
are not in sync with the local file systemkeepHistory
- a flag indicating whether or not to store
the current contents in the local historymonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.appendContents(java.io.InputStream,int,IProgressMonitor)
void appendContents(java.io.InputStream source, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
null
, will get closed
whether this method succeeds or fails.
The FORCE
update flag controls how this method deals with
cases where the workspace is not completely in sync with the local file
system. If FORCE
is not specified, the method will only attempt
to overwrite a corresponding file in the local file system provided
it is in sync with the workspace. This option ensures there is no
unintended data loss; it is the recommended setting.
However, if FORCE
is specified, an attempt will be made
to write a corresponding file in the local file system, overwriting any
existing one if need be. In either case, if this method succeeds, the
resource will be marked as being local (even if it wasn't before).
If this file is non-local then this method will always fail. The only exception
is when FORCE
is specified and the file exists in the local
file system. In this case the file is made local and the given contents are appended.
The KEEP_HISTORY
update flag controls whether or not a copy of
current contents of this file should be captured in the workspace's local
history (properties are not recorded in the local history). The local history
mechanism serves as a safety net to help the user recover from mistakes that
might otherwise result in data loss. Specifying KEEP_HISTORY
is recommended except in circumstances where past states of the files are of
no conceivable interest to the user. Note that local history is maintained
with each individual project, and gets discarded when a project is deleted
from the workspace. This flag is ignored if the file was not previously local.
Update flags other than FORCE
and KEEP_HISTORY
are ignored.
Prior to modifying the contents of this file, the file modification validator (if provided
by the VCM plug-in), will be given a chance to perform any last minute preparations. Validation
is performed by calling IFileModificationValidator.validateSave
on this file.
If the validation fails, then this operation will fail.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's content have been changed.
This method is long-running; progress and cancelation are provided by the given progress monitor.
source
- an input stream containing the new contents of the fileupdateFlags
- bit-wise or of update flag constants
(FORCE
and KEEP_HISTORY
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
FORCE
is not specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResourceRuleFactory.modifyRule(IResource)
void create(java.io.InputStream source, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
create(source, (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the file has been added to its parent.
This method is long-running; progress and cancellation are provided by the given progress monitor.
source
- an input stream containing the initial contents of the file,
or null
if the file should be marked as not localforce
- a flag controlling how to deal with resources that
are not in sync with the local file systemmonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.void create(java.io.InputStream source, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
null
then a file is not created in the local
file system and the created file resource is marked as being non-local.
The IResource.FORCE
update flag controls how this method deals with
cases where the workspace is not completely in sync with the local file
system. If IResource.FORCE
is not specified, the method will only attempt
to write a file in the local file system if it does not already exist.
This option ensures there is no unintended data loss; it is the recommended
setting. However, if IResource.FORCE
is specified, this method will
attempt to write a corresponding file in the local file system,
overwriting any existing one if need be.
The IResource.DERIVED
update flag indicates that this resource
should immediately be set as a derived resource. Specifying this flag
is equivalent to atomically calling IResource.setDerived(boolean)
with a value of true
immediately after creating the resource.
The IResource.TEAM_PRIVATE
update flag indicates that this resource
should immediately be set as a team private resource. Specifying this flag
is equivalent to atomically calling IResource.setTeamPrivateMember(boolean)
with a value of true
immediately after creating the resource.
The IResource.HIDDEN
update flag indicates that this resource
should immediately be set as a hidden resource. Specifying this flag
is equivalent to atomically calling IResource.setHidden(boolean)
with a value of true
immediately after creating the resource.
Update flags other than those listed above are ignored.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the file has been added to its parent.
This method is long-running; progress and cancellation are provided by the given progress monitor.
source
- an input stream containing the initial contents of the file,
or null
if the file should be marked as not localupdateFlags
- bit-wise or of update flag constants
(IResource.FORCE
, IResource.DERIVED
, and IResource.TEAM_PRIVATE
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).FORCE
is not specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResourceRuleFactory.createRule(IResource)
void createLink(org.eclipse.core.runtime.IPath localLocation, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
The IResource.ALLOW_MISSING_LOCAL
update flag controls how this
method deals with cases where the local file system file to be linked does
not exist, or is relative to a workspace path variable that is not defined.
If IResource.ALLOW_MISSING_LOCAL
is specified, the operation will succeed
even if the local file is missing, or the path is relative to an undefined
variable. If IResource.ALLOW_MISSING_LOCAL
is not specified, the operation
will fail in the case where the local file system file does not exist or the
path is relative to an undefined variable.
The IResource.REPLACE
update flag controls how this
method deals with cases where a resource of the same name as the
prospective link already exists. If IResource.REPLACE
is specified, then any existing resource with the same name is removed
from the workspace to make way for creation of the link. This does not
cause the underlying file system contents of that resource to be deleted.
If IResource.REPLACE
is not specified, this method will
fail if an existing resource exists of the same name.
The IResource.HIDDEN
update flag indicates that this resource
should immediately be set as a hidden resource. Specifying this flag
is equivalent to atomically calling IResource.setHidden(boolean)
with a value of true
immediately after creating the resource.
Update flags other than those listed above are ignored.
This method synchronizes this resource with the local file system at the given location.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the file has been added to its parent.
This method is long-running; progress and cancellation are provided by the given progress monitor.
localLocation
- a file system path where the file should be linkedupdateFlags
- bit-wise or of update flag constants
(IResource.ALLOW_MISSING_LOCAL
and IResource.REPLACE
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).ALLOW_MISSING_LOCAL
is
not specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResource.isLinked()
,
IResource.ALLOW_MISSING_LOCAL
void createLink(java.net.URI location, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
The ALLOW_MISSING_LOCAL
update flag controls how this
method deals with cases where the file system file to be linked does
not exist, or is relative to a workspace path variable that is not defined.
If ALLOW_MISSING_LOCAL
is specified, the operation will succeed
even if the local file is missing, or the path is relative to an undefined
variable. If ALLOW_MISSING_LOCAL
is not specified, the operation
will fail in the case where the file system file does not exist or the
path is relative to an undefined variable.
The IResource.REPLACE
update flag controls how this
method deals with cases where a resource of the same name as the
prospective link already exists. If IResource.REPLACE
is specified, then any existing resource with the same name is removed
from the workspace to make way for creation of the link. This does not
cause the underlying file system contents of that resource to be deleted.
If IResource.REPLACE
is not specified, this method will
fail if an existing resource exists of the same name.
The IResource.HIDDEN
update flag indicates that this resource
should immediately be set as a hidden resource. Specifying this flag
is equivalent to atomically calling IResource.setHidden(boolean)
with a value of true
immediately after creating the resource.
Update flags other than those listed above are ignored.
This method synchronizes this resource with the file system at the given location.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that the file has been added to its parent.
This method is long-running; progress and cancellation are provided by the given progress monitor.
location
- a file system URI where the file should be linkedupdateFlags
- bit-wise or of update flag constants
(IResource.ALLOW_MISSING_LOCAL
and IResource.REPLACE
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IWorkspace.validateName
).ALLOW_MISSING_LOCAL
is
not specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResource.isLinked()
,
IResource.ALLOW_MISSING_LOCAL
void delete(boolean force, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
delete((keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this folder has been removed from its parent.
This method is long-running; progress and cancellation are provided by the given progress monitor.
force
- a flag controlling whether resources that are not
in sync with the local file system will be toleratedkeepHistory
- a flag controlling whether files under this folder
should be stored in the workspace's local historymonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResource.delete(int,IProgressMonitor)
,
IResourceRuleFactory.deleteRule(IResource)
java.lang.String getCharset() throws org.eclipse.core.runtime.CoreException
This refinement of the corresponding IEncodedStorage
method
is a convenience method, fully equivalent to:
getCharset(true);
Note 1: this method does not check whether the result is a supported
charset name. Callers should be prepared to handle
UnsupportedEncodingException
where this charset is used.
Note 2: this method returns a cached value for the encoding that may be out of date if the file is not synchronized with the local file system and the encoding has since changed in the file system.
getCharset
in interface IEncodedStorage
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
getCharset(boolean)
,
IEncodedStorage.getCharset()
,
IContainer.getDefaultCharset()
java.lang.String getCharset(boolean checkImplicit) throws org.eclipse.core.runtime.CoreException
If checkImplicit is false
, this method will return the
charset defined by calling setCharset
, provided this file
exists, or null
otherwise.
If checkImplicit is true
, this method uses the following
algorithm to determine the charset to be returned:
IContainer#getDefaultCharset
).
Note 1: this method does not check whether the result is a supported
charset name. Callers should be prepared to handle
UnsupportedEncodingException
where this charset is used.
Note 2: this method returns a cached value for the encoding that may be out of date if the file is not synchronized with the local file system and the encoding has since changed in the file system.
null
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IEncodedStorage.getCharset()
,
IContainer.getDefaultCharset()
java.lang.String getCharsetFor(java.io.Reader reader) throws org.eclipse.core.runtime.CoreException
This method uses the following algorithm to determine the charset to be returned:
IContainer#getDefaultCharset
).
Note: this method does not check whether the result is a supported
charset name. Callers should be prepared to handle
UnsupportedEncodingException
where this charset is used.
reader
- a character stream containing the contents to be saved into this file
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
getCharset(boolean)
,
IContainer.getDefaultCharset()
org.eclipse.core.runtime.content.IContentDescription getContentDescription() throws org.eclipse.core.runtime.CoreException
null
if a description cannot be obtained.
Calling this method produces a similar effect as calling
getDescriptionFor(getContents(), getName(), IContentDescription.ALL)
on IContentTypeManager
, but provides better
opportunities for improved performance. Therefore, when manipulating
IFile
s, clients should call this method instead of
IContentTypeManager.getDescriptionFor
.
null
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IContentDescription
,
IContentTypeMatcher.getDescriptionFor(InputStream, String, QualifiedName[])
java.io.InputStream getContents() throws org.eclipse.core.runtime.CoreException
IStorage
method
returns an open input stream on the contents of this file.
The client is responsible for closing the stream when finished.
getContents
in interface IStorage
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
java.io.InputStream getContents(boolean force) throws org.eclipse.core.runtime.CoreException
IStorage
method
returns an open input stream on the contents of this file.
The client is responsible for closing the stream when finished.
If force is true
the file is opened and an input
stream returned regardless of the sync state of the file. The file
is not synchronized with the workspace.
If force is false
the method fails if not in sync.
force
- a flag controlling how to deal with resources that
are not in sync with the local file system
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
false
.int getEncoding() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
org.eclipse.core.runtime.IPath getFullPath()
IStorage
and IResource
methods links the semantics of resource and storage object paths such that
IFile
s always have a path and that path is relative to the
containing workspace.
getFullPath
in interface IResource
getFullPath
in interface IStorage
IResource.getFullPath()
,
IStorage.getFullPath()
IFileState[] getHistory(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This method is long-running; progress and cancellation are provided by the given progress monitor.
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails.
org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.java.lang.String getName()
IStorage
and IResource
methods links the semantics of resource and storage object names such that
IFile
s always have a name and that name equivalent to the
last segment of its full path.
getName
in interface IResource
getName
in interface IStorage
IResource.getName()
,
IStorage.getName()
boolean isReadOnly()
IStorage
and IResource
methods links the semantics of read-only resources and read-only storage objects.
isReadOnly
in interface IResource
isReadOnly
in interface IStorage
true
if this resource is read-only,
false
otherwiseIResource.isReadOnly()
,
IStorage.isReadOnly()
void move(org.eclipse.core.runtime.IPath destination, boolean force, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
move(destination, (keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file has been removed from its parent and a new file has been added to the parent of the destination.
This method is long-running; progress and cancellation are provided by the given progress monitor.
destination
- the destination pathforce
- a flag controlling whether resources that are not
in sync with the local file system will be toleratedkeepHistory
- a flag controlling whether files under this folder
should be stored in the workspace's local historymonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this resource could not be moved. Reasons include:
force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResource.move(IPath,int,IProgressMonitor)
,
IResourceRuleFactory.moveRule(IResource, IResource)
void setCharset(java.lang.String newCharset) throws org.eclipse.core.runtime.CoreException
setCharset(String, IProgressMonitor)
which
is a workspace operation and reports changes in resource deltas.
null
will remove the charset setting for this resource.
newCharset
- a charset name, or null
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
getCharset()
void setCharset(java.lang.String newCharset, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
null
will remove the charset setting for this resource.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's encoding has changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
newCharset
- a charset name, or null
monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
IResourceChangeEvent
for more details.getCharset()
,
IResourceRuleFactory.charsetRule(IResource)
void setContents(java.io.InputStream source, boolean force, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
setContents(source, (keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's contents have been changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
source
- an input stream containing the new contents of the fileforce
- a flag controlling how to deal with resources that
are not in sync with the local file systemkeepHistory
- a flag indicating whether or not store
the current contents in the local historymonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.setContents(java.io.InputStream,int,IProgressMonitor)
void setContents(IFileState source, boolean force, boolean keepHistory, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
This is a convenience method, fully equivalent to:
setContents(source, (keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's content have been changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
source
- a previous state of this resourceforce
- a flag controlling how to deal with resources that
are not in sync with the local file systemkeepHistory
- a flag indicating whether or not store
the current contents in the local historymonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
force
is false
.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.setContents(IFileState,int,IProgressMonitor)
void setContents(java.io.InputStream source, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
null
then the content is set to be the
empty sequence of bytes.
The FORCE
update flag controls how this method deals with
cases where the workspace is not completely in sync with the local file
system. If FORCE
is not specified, the method will only attempt
to overwrite a corresponding file in the local file system provided
it is in sync with the workspace. This option ensures there is no
unintended data loss; it is the recommended setting.
However, if FORCE
is specified, an attempt will be made
to write a corresponding file in the local file system, overwriting any
existing one if need be. In either case, if this method succeeds, the
resource will be marked as being local (even if it wasn't before).
The KEEP_HISTORY
update flag controls whether or not a copy of
current contents of this file should be captured in the workspace's local
history (properties are not recorded in the local history). The local history
mechanism serves as a safety net to help the user recover from mistakes that
might otherwise result in data loss. Specifying KEEP_HISTORY
is recommended except in circumstances where past states of the files are of
no conceivable interest to the user. Note that local history is maintained
with each individual project, and gets discarded when a project is deleted
from the workspace. This flag is ignored if the file was not previously local.
Update flags other than FORCE
and KEEP_HISTORY
are ignored.
Prior to modifying the contents of this file, the file modification validator (if provided
by the VCM plug-in), will be given a chance to perform any last minute preparations. Validation
is performed by calling IFileModificationValidator.validateSave
on this file.
If the validation fails, then this operation will fail.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's content have been changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
source
- an input stream containing the new contents of the fileupdateFlags
- bit-wise or of update flag constants
(FORCE
and KEEP_HISTORY
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
FORCE
is not specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResourceRuleFactory.modifyRule(IResource)
void setContents(IFileState source, int updateFlags, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
The FORCE
update flag controls how this method deals with
cases where the workspace is not completely in sync with the local file
system. If FORCE
is not specified, the method will only attempt
to overwrite a corresponding file in the local file system provided
it is in sync with the workspace. This option ensures there is no
unintended data loss; it is the recommended setting.
However, if FORCE
is specified, an attempt will be made
to write a corresponding file in the local file system, overwriting any
existing one if need be. In either case, if this method succeeds, the
resource will be marked as being local (even if it wasn't before).
The KEEP_HISTORY
update flag controls whether or not a copy of
current contents of this file should be captured in the workspace's local
history (properties are not recorded in the local history). The local history
mechanism serves as a safety net to help the user recover from mistakes that
might otherwise result in data loss. Specifying KEEP_HISTORY
is recommended except in circumstances where past states of the files are of
no conceivable interest to the user. Note that local history is maintained
with each individual project, and gets discarded when a project is deleted
from the workspace. This flag is ignored if the file was not previously local.
Update flags other than FORCE
and KEEP_HISTORY
are ignored.
Prior to modifying the contents of this file, the file modification validator (if provided
by the VCM plug-in), will be given a chance to perform any last minute preparations. Validation
is performed by calling IFileModificationValidator.validateSave
on this file.
If the validation fails, then this operation will fail.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this file's content have been changed.
This method is long-running; progress and cancellation are provided by the given progress monitor.
source
- a previous state of this resourceupdateFlags
- bit-wise or of update flag constants
(FORCE
and KEEP_HISTORY
)monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
FORCE
is not specified.IResourceChangeEvent
for more details.org.eclipse.core.runtime.OperationCanceledException
- if the operation is canceled.
Cancelation can occur even if no progress monitor is provided.IResourceRuleFactory.modifyRule(IResource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |