Class FileMetadata

java.lang.Object
org.sonar.api.batch.fs.internal.FileMetadata

@Immutable public class FileMetadata extends Object
Computes hash of files. Ends of Lines are ignored, so files with same content but different EOL encoding have the same hash.
  • Constructor Details

    • FileMetadata

      public FileMetadata(org.sonar.api.notifications.AnalysisWarnings analysisWarnings)
  • Method Details

    • readMetadata

      public Metadata readMetadata(InputStream stream, Charset encoding, String filePath, @Nullable CharHandler otherHandler)
      Compute hash of a file ignoring line ends differences. Maximum performance is needed.
    • readMetadata

      public Metadata readMetadata(InputStream stream, Charset encoding, String filePath)
    • readMetadata

      public Metadata readMetadata(Reader reader)
      For testing purpose
    • readFile

      public static void readFile(InputStream stream, Charset encoding, String filePath, CharHandler[] handlers)
    • computeLineHashesForIssueTracking

      public static void computeLineHashesForIssueTracking(org.sonar.api.batch.fs.InputFile f, FileMetadata.LineHashConsumer consumer)
      Compute a MD5 hash of each line of the file after removing of all blank chars