Class FileChecker
java.lang.Object
io.github.sergeloie.languagecheck.check.FileChecker
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 Summary
Modifier and TypeMethodDescriptionstatic booleancheckFile(File projectDir, String rel, CharPolicy policy, boolean utf8Exempt, long maxFileSize, int maxSamples, CharacterChecker checker, ReportAccumulator report) Read and check a single file, updating the report accumulator.static StringdecodeUtf8(byte[] bytes, boolean lenient) Decodebytesas UTF-8.static booleanisBinary(byte[] bytes)
-
Method Details
-
isBinary
public static boolean isBinary(byte[] bytes) -
decodeUtf8
Decodebytesas 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 andnullis 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
-