in src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java [68:90]
private static void populateContentDetails(Path file, byte[] content, DigestItem item) throws IOException {
String contentType = Files.probeContentType(file);
if (contentType != null) {
item.setContent(contentType);
}
final boolean binary = isBinary(contentType);
item.setIsText(isText(contentType) ? "yes" : binary ? "no" : "unknown");
if (!binary) { // probing application/ files as well though might be binary
UniversalDetector detector = ENCODING_DETECTOR.get();
detector.reset();
detector.handleData(content, 0, Math.min(content.length, 16 * 1024));
detector.dataEnd();
String detectedCharset = detector.getDetectedCharset();
Charset charset = UTF_8;
if (detectedCharset != null) {
item.setCharset(detectedCharset);
charset = Charset.forName(detectedCharset);
}
CharBuffer charBuffer = charset.decode(ByteBuffer.wrap(content));
String lineSeparator = detectLineSeparator(charBuffer);
item.setEol(StringUtils.defaultString(lineSeparator, "unknown"));
}
}