Package org.eclipse.cdt.core.parser
Class FileContent
- java.lang.Object
-
- org.eclipse.cdt.core.parser.FileContent
-
public abstract class FileContent extends Object
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
Fields Modifier and Type Field Description static longNULL_FILE_SIZEstatic longNULL_TIMESTAMP
-
Constructor Summary
Constructors Constructor Description FileContent()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FileContentadapt(CodeReader reader)Deprecated.static FileContentcreate(String filePath, boolean isSource, char[] contents)Creates a file content object for a fixed buffer.static FileContentcreate(String filePath, char[] contents)Creates a file content object for a fixed buffer.static FileContentcreate(IIndexFileLocation ifl)Creates a file content object for an index file location.static FileContentcreate(ITranslationUnit tu)Creates a file content object for a translation-unit, which may be a working copy.static FileContentcreate(org.eclipse.core.resources.IFile file)Creates a file content for a workspace header file.static FileContentcreateForExternalFileLocation(String fileLocation)Creates a file content object for a header file that is not part of the workspace.static FileContentcreateForExternalFileLocation(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 FileContentcreateForExternalFileLocation(String fileLocation, String encoding)Creates a file content object for a header file that is not part of the workspace.abstract longgetContentsHash()Returns a 64-bit hash value of the file contents.abstract StringgetFileLocation()Returns the location of this file content as it will appear inIASTFileLocation.getFileName()abstract longgetFileSize()Returns the size of the file, or NULL_FILE_SIZE if the content does not originate from a file.abstract longgetReadTime()Returns time when the file was read.abstract longgetTimestamp()Returns the modification time of the file containing the content, or NULL_TIMESTAMP if the content does not originate from a file.abstract booleanhasError()Returnstrueif there were I/O errors while retrieving contents of this file.
-
-
-
Field Detail
-
NULL_TIMESTAMP
public static final long NULL_TIMESTAMP
- Since:
- 5.4
- See Also:
- Constant Field Values
-
NULL_FILE_SIZE
public static final long NULL_FILE_SIZE
- Since:
- 5.4
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFileLocation
public abstract String 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()
Returnstrueif 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
public static FileContent create(String filePath, char[] contents)
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
public static FileContent create(String filePath, boolean isSource, char[] contents)
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
public static FileContent create(ITranslationUnit tu)
Creates a file content object for a translation-unit, which may be a working copy.
-
create
public static FileContent create(IIndexFileLocation ifl)
Creates a file content object for an index file location.
-
create
public static FileContent create(org.eclipse.core.resources.IFile file)
Creates a file content for a workspace header file.
-
createForExternalFileLocation
public static FileContent createForExternalFileLocation(String fileLocation)
Creates a file content object for a header file that is not part of the workspace.
-
createForExternalFileLocation
public static FileContent createForExternalFileLocation(String fileLocation, String encoding)
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 public static FileContent adapt(CodeReader reader)
Deprecated.Provided to achieve backwards compatibility.
-
-