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 Details

  • Constructor Details

    • FileContent

      public FileContent()
  • Method Details

    • getFileLocation

      public abstract String getFileLocation()
      Returns the location of this file content as it will appear in IASTFileLocation.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()
      Returns true 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

      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 in IASTFileLocation.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 in IASTFileLocation.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.