io.codemodder.DefaultEncodingDetector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codemodder-base Show documentation
Show all versions of codemodder-base Show documentation
Base framework for writing codemods in Java
package io.codemodder;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Optional;
import org.mozilla.universalchardet.UniversalDetector;
final class DefaultEncodingDetector implements EncodingDetector {
@Override
public Optional detect(final Path originalJavaFile) throws IOException {
String encoding = UniversalDetector.detectCharset(originalJavaFile);
return Optional.ofNullable(encoding);
}
}