Package org.eclipse.cdt.core.parser
Class FileContent
java.lang.Object
org.eclipse.cdt.core.parser.FileContent
Abstract class for representing the content of a file.
It serves as the input to the preprocessor.
- Since:
- 5.2
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
static final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FileContent
adapt
(CodeReader reader) Deprecated.static FileContent
Creates a file content object for a fixed buffer.static FileContent
Creates a file content object for a fixed buffer.static FileContent
create
(IIndexFileLocation ifl) Creates a file content object for an index file location.static FileContent
Creates a file content object for a translation-unit, which may be a working copy.static FileContent
create
(org.eclipse.core.resources.IFile file) Creates a file content for a workspace header file.static FileContent
createForExternalFileLocation
(String fileLocation) Creates a file content object for a header file that is not part of the workspace.static FileContent
createForExternalFileLocation
(String fileLocation, boolean isSource, String encoding) Creates a file content object for a header or a source file that is not part of the workspace.static FileContent
createForExternalFileLocation
(String fileLocation, String encoding) Creates a file content object for a header file that is not part of the workspace.abstract long
Returns a 64-bit hash value of the file contents.abstract String
Returns the location of this file content as it will appear inIASTFileLocation.getFileName()
abstract long
Returns the size of the file, or NULL_FILE_SIZE if the content does not originate from a file.abstract long
Returns time when the file was read.abstract long
Returns the modification time of the file containing the content, or NULL_TIMESTAMP if the content does not originate from a file.abstract boolean
hasError()
Returnstrue
if there were I/O errors while retrieving contents of this file.
-
Field Details
-
NULL_TIMESTAMP
public static final long NULL_TIMESTAMP- Since:
- 5.4
- See Also:
-
NULL_FILE_SIZE
public static final long NULL_FILE_SIZE- Since:
- 5.4
- See Also:
-
-
Constructor Details
-
FileContent
public FileContent()
-
-
Method Details
-
getFileLocation
Returns the location of this file content as it will appear inIASTFileLocation.getFileName()
-
getTimestamp
public abstract long getTimestamp()Returns the modification time of the file containing the content, or NULL_TIMESTAMP if the content does not originate from a file. A zero value may be returned if there was an I/O error.- Since:
- 5.4
-
getReadTime
public abstract long getReadTime()Returns time when the file was read. Corresponds to the start of reading.- Returns:
- time before reading started in milliseconds since epoch
- Since:
- 5.4
-
getFileSize
public abstract long getFileSize()Returns the size of the file, or NULL_FILE_SIZE if the content does not originate from a file. A zero value may be returned if there was an I/O error.- Since:
- 5.4
-
hasError
public abstract boolean hasError()Returnstrue
if there were I/O errors while retrieving contents of this file.- Since:
- 5.4
-
getContentsHash
public abstract long getContentsHash()Returns a 64-bit hash value of the file contents. -
create
Creates a file content object for a fixed buffer.- Parameters:
filePath
- the path of the file as it will appear inIASTFileLocation.getFileName()
contents
- the actual content.
-
create
Creates a file content object for a fixed buffer.- Parameters:
filePath
- the path of the file as it will appear inIASTFileLocation.getFileName()
contents
- the actual content.- Since:
- 6.3
-
create
Creates a file content object for a translation-unit, which may be a working copy. -
create
Creates a file content object for an index file location. -
create
Creates a file content for a workspace header file. -
createForExternalFileLocation
Creates a file content object for a header file that is not part of the workspace. -
createForExternalFileLocation
Creates a file content object for a header file that is not part of the workspace.- Since:
- 5.3
-
createForExternalFileLocation
public static FileContent createForExternalFileLocation(String fileLocation, boolean isSource, String encoding) Creates a file content object for a header or a source file that is not part of the workspace.- Since:
- 6.3
-
adapt
Deprecated.Provided to achieve backwards compatibility.
-