Interface IVirtualFileContentManager
-
public interface IVirtualFileContentManager
Virtual file content manager. Provides API for reading and writing content ofVirtualFile
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description InputStream
getContents()
Returns an open input stream on the contents of virtual file.int
getEncoding()
Returns a constant identifying the character encoding of content of virtual file, or ENCODING_UNKNOWN if it could not be determined.void
setContents(InputStream source, org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the contents of virtual file to the bytes in the given input stream.
-
-
-
Method Detail
-
getEncoding
int getEncoding() throws org.eclipse.core.runtime.CoreException
Returns a constant identifying the character encoding of content of virtual file, or ENCODING_UNKNOWN if it could not be determined. The returned constant will be one of the ENCODING_* constants defined on IFile.- Returns:
- The character encoding of this file
- Throws:
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:- This resource could not be read.
-
getContents
InputStream getContents() throws org.eclipse.core.runtime.CoreException
Returns an open input stream on the contents of virtual file. The client is responsible for closing the stream when finished.- Returns:
- an input stream containing the contents of the file
- Throws:
org.eclipse.core.runtime.CoreException
- if this method fails
-
setContents
void setContents(InputStream source, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Sets the contents of virtual file to the bytes in the given input stream. The stream will get closed whether this method succeeds or fails. If the stream isnull
then the content is set to be the empty sequence of bytes.This method is long-running; progress and cancellation are provided by the given progress monitor.
- Parameters:
source
- an input stream containing the new contents of the filemonitor
- a progress monitor, ornull
if progress reporting is not desired- Throws:
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.
-
-