Here you can find the source of isTextFile(File f)
private static boolean isTextFile(File f)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { private static boolean isTextFile(File f) { if (!f.isFile()) { return false; }/*from ww w .j a va 2 s . c om*/ final String name = f.getName(); final int lastDotIdx = name.lastIndexOf('.'); if (lastDotIdx < 0) { return false; } final String extension = name.substring(lastDotIdx + 1); switch (extension) { case "buildinfo": case "html": case "css": case "js": case "svg": case "txt": case "xml": return true; case "map": return name.endsWith(".css.map") || name.endsWith(".js.map"); } return false; } }