Class FileChecker

java.lang.Object
io.github.sergeloie.languagecheck.check.FileChecker

public final class FileChecker extends Object
Low-level file checks: size guard, binary detection, UTF-8 decoding and policy evaluation. Used by LanguageCheckTask to keep the task itself as a thin orchestrator.
  • Method Details

    • isBinary

      public static boolean isBinary(byte[] bytes)
    • decodeUtf8

      public static String decodeUtf8(byte[] bytes, boolean lenient)
      Decode bytes as UTF-8.
      Parameters:
      lenient - when true, bytes are decoded as ISO-8859-1 (true byte-wise check per spec for utf8Exempt extensions). When false, strict UTF-8 is required and null is returned on malformed input.
    • checkFile

      public static boolean checkFile(File projectDir, String rel, CharPolicy policy, boolean utf8Exempt, long maxFileSize, int maxSamples, CharacterChecker checker, ReportAccumulator report) throws IOException
      Read and check a single file, updating the report accumulator.
      Returns:
      true if the file was counted as checked (i.e. not skipped)
      Throws:
      IOException