public static String detectMimeType(File file) { if (file == null || !file.exists()) { return null;
public static String detectMimeType(InputStream is) throws IOException { byte[] buffer = new byte[1024]; int read = 0; read = is.read(buffer); int binaryCount = 0; for (int i = 0; i < read; i++) { byte b = buffer[i]; if (b == 0) { return BINARY_MIME_TYPE; } if (b < 0x07 || (b > 0x0d && b < 0x20) || b > 0x7F) { binaryCount++; }
    public static String detectMimeType(File file) {        if (file == null || !file.exists()) {            return null;        }        InputStream is = null;        try {            is = openFileForReading(file);            return detectMimeType(is);        } catch (IOException e) {            return null;        } catch (SVNException e) {            return null;        } finally {            closeFile(is);        }    }