/** * Replace special characters with entities for XML attributes. * special: '&', '<', '>', '\'', '"', '\r', '\n' * * @param x string to quote * @return equivilent string using entities for any special chars */ static public String quoteXmlContent(String x) { return StringUtil2.replace(x, xmlInC, xmlOutC); }
/** * Replace special characters with entities for HTML content. * special: '&', '"', '\'', '<', '>', '\n' * * @param x string to quote * @return equivilent string using entities for any special chars */ static public String quoteHtmlContent(String x) { return replace(x, htmlIn, htmlOut); }
/** * Replace special characters with entities for HTML content. * special: '&', '"', '\'', '<', '>', '\n' * * @param x string to quote * @return equivilent string using entities for any special chars */ static public String quoteHtmlContent(String x) { return replace(x, htmlIn, htmlOut); }
/** * Replace special characters with entities for XML attributes. * special: '&', '<', '>', '\'', '"', '\r', '\n' * * @param x string to quote * @return equivilent string using entities for any special chars */ static public String quoteXmlAttribute(String x) { return replace(x, xmlIn, xmlOut); }
/** * Replace special characters with entities for XML attributes. * special: '&', '<', '>', '\'', '"', '\r', '\n' * * @param x string to quote * @return equivilent string using entities for any special chars */ static public String quoteXmlContent(String x) { return StringUtil2.replace(x, xmlInC, xmlOutC); }
/** * @deprecated legacy only, use HtmlEscapers.htmlEscaper() */ static public String quoteHtmlContent(String x) { if (x == null) return null; return replace(x, htmlIn, htmlOut); } }
public static String[] getDefinitionFiles() { if (fmrcDefinitionFiles == null) { fmrcDefinitionFiles = new String[fmrcDatasets.length]; int count = 0; for (String ds : fmrcDatasets) { fmrcDefinitionFiles[count++] = fmrcDefinitionDir + StringUtil2.replace(ds, '/', "-") + ".fmrcDefinition.xml"; } } return fmrcDefinitionFiles; }
/** * Replace special characters '\t', '\n', '\f', '\r'. * * @param s string to quote * @return equivilent string replacing special chars */ static public String encodeString(String s) { return StringUtil2.replace(s, org, replace); }
/** * Replace special characters with entities for XML attributes. * special: '&', '<', '>', '\'', '"', '\r', '\n' * * @param x string to quote * @return equivilent string using entities for any special chars */ static public String quoteXmlContent(String x) { return replace(x, xmlInC, xmlOutC); }
/** * Replace special characters '\t', '\n', '\f', '\r'. * * @param s string to quote * @return equivilent string replacing special chars */ static public String encodeString(String s) { return StringUtil2.replace(s, org, replace); }
public static String[] getRoots() { String rootString = StringUtil2.replace(roots, "\n", ","); String[] root2 = rootString.split(","); String[] result = new String[root2.length/2]; for (int i = 0; i < root2.length; i += 2) { result[i/2] = root2[i]; } return result; }
@Override public String getPath() { // no microsnot return StringUtil2.replace(file.getPath(), '\\', "/"); }
static public String cleanName(String name) { if (name == null) System.out.println("HEY cleanName"); return StringUtil2.replace(name.trim(), ' ', "_"); // LOOK must be ok in URL - probably not sufficient here }
@Override public String getPath() { String path = new File(directory, name).getPath(); return StringUtil2.replace(path, '\\', "/"); }
@Override public boolean accept(Path entry) throws IOException { String matchOn = nameOnly ? entry.getName(entry.getNameCount()-1).toString() : StringUtil2.replace(entry.toString(), "\\", "/"); java.util.regex.Matcher matcher = this.pattern.matcher(matchOn); boolean ok = matcher.matches(); //System.out.printf("%s %s%n", ok, matchOn); return ok; } }
public FileCacheable open(DatasetUrl durl, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException { String location = StringUtil2.replace(durl.trueurl, "\\", "/"); // canonicalize the name RandomAccessFile result = new RandomAccessFile(location, "r", buffer_size); result.cacheState = 1; // in use return result; } };
public CacheDirectory(File dir) { super(dir); this.parentDirName = StringUtil2.replace(dir.getParent(), '\\', "/"); File[] subs = dir.listFiles(); if (subs == null) subs = new File[0]; children = new CacheFile[subs.length]; int count = 0; for (File f : subs) { children[count++] = new CacheFile(f); } }
/** * Set the cache root directory. Create it if it doesnt exist. * * @param cacheDir the cache directory */ static public void setRootDirectory(String cacheDir) { if (!cacheDir.endsWith("/")) cacheDir = cacheDir + "/"; root = StringUtil2.replace(cacheDir, '\\', "/"); // no nasty backslash makeRootDirectory(); }
public static PathMatcher readRoots() { PathMatcher pathMatcher = new PathMatcher(); String rootString = StringUtil2.replace(roots, "\n", ","); String[] roots = rootString.split(","); for (int i = 0; i < roots.length; i += 2) { if (showRoots) System.out.printf(" %-40s %-40s%n", roots[i], roots[i + 1]); pathMatcher.put(roots[i], roots[i + 1]); } return pathMatcher; }
public String makeId() { LatLonPointImpl center = (LatLonPointImpl) getCenterLatLon(); StringBuilder result = new StringBuilder(name + "_" + ny + "X" + nx+"-"+center.toString(2)); StringUtil2.replace(result, ". ","p-"); return result.toString(); }