@Override public String getName() throws MException { return MString.afterLastIndex(name, '/'); }
public JmxObject() { jmxType = MString.afterLastIndex(getClass().getCanonicalName(), '.'); }
/** * Returns the name without path and extension. * * @param key * @return file name */ public static String getFileNameOnly(String key) { if (key == null) return null; if (key.indexOf('/') >= 0) key = MString.afterLastIndex(key, '/'); if (key.indexOf('\\') >= 0) key = MString.afterLastIndex(key, '\\'); if (key.length() > 1 && key.indexOf('.',1) >= 0) key = MString.beforeLastIndex(key, '.'); return key; }
/** * Returns the name of the file in a path name. Using the OS specific * separator. * @param path * @return the file name */ public static String getFileName(String path) { if (path == null) return null; if (MString.isIndex(path, File.separatorChar)) path = MString.afterLastIndex(path, File.separatorChar); return path; }
public static String getFileName(String path) { if (path == null) return null; if (MString.isIndex(path, "/")) path = MString.afterLastIndex(path, "/"); return path; }
/** * Return the Suffix of a file. Its the string after the last dot or an empty string. * @param name * @return the file suffix */ public static String getFileSuffix(String name) { if (name == null) return null; if (!MString.isIndex(name, '.')) return ""; name = MString.afterLastIndex(name, '.'); return name; }
protected String getType() { Class<?> clazz = element.getElementClass(); while (clazz != null && !clazz.getCanonicalName().startsWith("de.mhus.cherry.reactive.")) clazz = clazz.getSuperclass(); if (clazz != null) return MString.afterLastIndex(clazz.getCanonicalName(), '.'); return MString.afterLastIndex(element.getCanonicalName(), '.'); }
/** * Searching for the mime type in config and as last option have a static list of extensions. * @param extension full file name or only extension * @param def * @return the mime type */ public static String getMimeType(String extension, String def) { if (extension == null) return null; extension = extension.trim().toLowerCase(); if (MString.isIndex(extension, '.')) extension = MString.afterLastIndex(extension, '.'); String mime = null; try { if (mimeProperties.value() != null) mime = mimeProperties.value().getString(extension, null); } catch (Throwable t) {} if (mime == null) { loadMimeTypes(); if (mhuMimeConfigCache != null) { mime = mhuMimeConfigCache.getProperty(extension, null); } } if (mime == null) mime = def; return mime; }
millies = toint(MString.afterLastIndex(time, '.'), 0); time = MString.beforeLastIndex(time, '.');