/** * @param tag * @return */ private String getTagName(String tag) { if (MString.isIndex(tag, MString.WHITESPACE)) { return MString.beforeIndex(tag, MString.WHITESPACE); } return tag; }
/** * 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; }
/** * 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; }
public static String getFileDirectory(String path) { if (path == null) return null; if (MString.isIndex(path, "/")) { String ret = MString.beforeLastIndex(path, "/"); while (ret.endsWith("/")) ret = ret.substring(0, ret.length()-1); if (ret.length() == 0) return null; return ret; } return null; }
/** * Returns the directory without file name or current directory. * /dir/subdir/file will return /dir/subdir * @param path * @return The previous directory name or null */ public static String getFileDirectory(String path) { if (path == null) return null; if (MString.isIndex(path, File.separatorChar)) { String ret = MString.beforeLastIndex(path, File.separatorChar); while (ret.endsWith(""+File.separatorChar)) ret = ret.substring(0, ret.length()-1); if (ret.length() == 0) return null; return ret; } return null; }
if (!MString.isIndex(tag, MString.WHITESPACE)) { return out;
/** * 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; }
if ( MString.isIndex(date, '_' ) ) sep = '_'; else if ( MString.isIndex(date, ' ' ) ) sep = ' '; else if (MString.isIndex(date, 'T')) sep = 'T'; if (sep == ' ' && MString.isIndex(date, ',')) { int p1 = date.indexOf(' '); int p2 = date.indexOf(','); if ( MString.isIndex(time, ' ' ) ) sep2 = ' '; else if ( MString.isIndex(time, '_' ) ) sep2 = '_'; else if (MString.isIndex(time, 'Z')) sep2 = 'Z'; if (MString.isIndex(time, '.')) { millies = toint(MString.afterLastIndex(time, '.'), 0); time = MString.beforeLastIndex(time, '.'); if (time.length() > 0) { String sep3 = null; if (MString.isIndex(time, ':'))
@SuppressWarnings("rawtypes") private ResourceNode getResource(FileResource parent, String target) { if (parent == null || target == null) return null; if (target.length() == 0) return parent; String next = null; if (MString.isIndex(target, '/')) { next = MString.beforeIndex(target, '/'); target = MString.afterIndex(target, '/'); } else { next = target; target = ""; } if (next.length() == 0) return getResource(parent,target); ResourceNode n = parent.getNode(next); if (n == null) return null; return getResource((FileResource) n, target); }
String date = null; String msg = ""; if (MString.isIndex(line, ' ')) { date = MString.beforeIndex(line, ' ').trim(); msg = MString.afterIndex(line, ' ').trim();
public ParameterDefinition(String line) { if (MString.isIndex(line, ',')) { name = MString.beforeIndex(line, ','); line = MString.afterIndex(line, ','); properties = MProperties.explodeToMProperties(line.split(","), ':', (char)0); } else { name = line; if (name.startsWith("*")) { mandatory = true; name = name.substring(1); } type = "string"; return; } if (name.startsWith("*")) { mandatory = true; name = name.substring(1); } type = properties.getString("type", ""); mandatory = properties.getBoolean("mandatory", mandatory); def = properties.getString("default", null); mapping = properties.getString("mapping",null); format = properties.getString("format", null); }