List of usage examples for java.lang StringBuffer delete
@Override public synchronized StringBuffer delete(int start, int end)
From source file:hydrograph.ui.perspective.dialog.PreStartActivity.java
/** * Checks whether given JDK-PATH is valid or not. * /*from w ww .j av a 2s .com*/ * @param javaHome * input jdk path * @param showPopUp * true if user wants to show pop for invalid path. * @return * true if input string is valid JDK path. */ public static boolean isValidJDKPath(String javaHome, boolean showPopUp) { try { if (javaHome != null && isValidDirectory(javaHome, showPopUp)) { if (StringUtils.endsWith(javaHome, SLASH_BIN)) { javaHome = StringUtils.replace(javaHome, SLASH_BIN, ""); } if (StringUtils.isNotBlank(javaHome)) { StringBuffer jdkPath = new StringBuffer(javaHome); jdkPath = jdkPath.delete(0, jdkPath.lastIndexOf("\\") + 1); return checkJDKVersion(jdkPath.toString(), showPopUp); } } } catch (Exception exception) { logger.warn("Exception occurred while validating javaHome path", exception); } return false; }
From source file:edu.iu.dymoro.RotationUtil.java
public static void printRotateOrder(int[] order, int numWorkers) { if (order != null) { int rowLen = 2 * numWorkers - 1; int numIterations = order.length / rowLen; StringBuffer sb = new StringBuffer(); int orderIndex = 0; for (int i = 0; i < numIterations; i++) { for (int j = 0; j < rowLen; j++) { sb.append(order[orderIndex++] + " "); }/* w w w . j av a 2s . c o m*/ LOG.info(sb); sb.delete(0, sb.length()); } } }
From source file:org.eclipse.dirigible.ide.db.export.DataExportServiceHandler.java
/** * Generate the download URL/*from w w w. ja v a2s . c o m*/ * * @param tableName * @return the URL */ public static String getUrl(String tableName) { ServiceManager manager = RWT.getServiceManager(); String rootURL = manager.getServiceHandlerUrl(DataExportServiceHandler_SERVICE_HANDLER_ID); StringBuffer url = new StringBuffer(); url.append(rootURL); url.append(AMP); url.append(FILENAME_PARAM).append(EQ).append(tableName.toLowerCase()).append(DSV_EXTENSION); int relativeIndex = url.lastIndexOf(SLASH); if (relativeIndex > -1) { url.delete(0, relativeIndex + 1); } return RWT.getResponse().encodeURL(url.toString()); }
From source file:com.microsoft.intellij.util.WAHelper.java
public static WindowsAzureRole prepareRoleToAdd(WindowsAzureProjectManager waProjManager) { WindowsAzureRole windowsAzureRole = null; try {//from w w w . j a va2 s. co m StringBuffer strBfr = new StringBuffer(message("dlgWorkerRole1")); int roleNo = 2; while (!waProjManager.isAvailableRoleName(strBfr.toString())) { strBfr.delete(10, strBfr.length()); strBfr.append(roleNo++); } String strKitLoc = WAHelper.getTemplateFile(message("pWizStarterKit")); windowsAzureRole = waProjManager.addRole(strBfr.toString(), strKitLoc); windowsAzureRole.setInstances(message("rolsNoOfInst")); windowsAzureRole.setVMSize(message("rolsVMSmall")); } catch (Exception e) { log(e.getMessage()); } return windowsAzureRole; }
From source file:Main.java
public static String findTag(String tagName, StringBuffer result) { String search = result.toString(); String startTag = "<" + tagName + ">"; String endTag = "</" + tagName + ">"; int start = search.indexOf(startTag); int end = search.indexOf(endTag); if (start == -1 || end == -1) { return null; }/* w w w.j a va 2s. c o m*/ String val = search.substring(start + startTag.length(), end); result.delete(0, end + endTag.length()); return val; }
From source file:org.eclipse.rwt.widgets.codemirror.internal.CodeMirrorJSService.java
/** * Builds a url which points to the service handler and encodes the given parameters * as url parameters. //w ww .j ava 2s. co m */ public static String getBaseUrl() { StringBuffer url = new StringBuffer(); url.append(URLHelper.getURLString(false)); URLHelper.appendFirstParam(url, REQUEST_PARAM, SERVICE_HANDLER_ID); // convert to relative URL int firstSlash = url.indexOf("/", url.indexOf("//") + 2); // first slash after double slash of "http://" url.delete(0, firstSlash + 1); // Result is sth like "/rap?custom_service_handler..." return RWT.getResponse().encodeURL(url.toString()); }
From source file:org.owasp.proxy.http.dao.JdbcMessageDAOTest.java
private static void dump(String sql) { logger.fine("\n" + sql); SqlRowSet rs = dao.getJdbcTemplate().queryForRowSet(sql); try {// w w w .jav a 2 s .c om SqlRowSetMetaData rsmd = rs.getMetaData(); int c = rsmd.getColumnCount(); StringBuffer buff = new StringBuffer(); for (int i = 1; i <= c; i++) { buff.append(rsmd.getColumnLabel(i)); buff.append(i == c ? "\n" : "\t"); } logger.fine(buff.toString()); buff.delete(0, buff.length()); while (rs.next()) { for (int i = 1; i <= c; i++) { buff.append(rs.getObject(i)); buff.append(i == c ? "\n" : "\t"); } logger.fine(buff.toString()); buff.delete(0, buff.length()); } logger.fine("================\n\n"); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.dbgl.util.searchengine.WebSearchEngine.java
protected static String removeTag(final String openTag, final String closeTag, final String htmlChunk) { StringBuffer result = new StringBuffer(htmlChunk); int openingIndex = StringUtils.indexOfIgnoreCase(result, openTag); while (openingIndex != -1) { result.delete(openingIndex, result.indexOf(">", openingIndex + openTag.length()) + 1); int closingIndex = StringUtils.indexOfIgnoreCase(result, closeTag); result.delete(closingIndex, closingIndex + closeTag.length()); openingIndex = StringUtils.indexOfIgnoreCase(result, openTag); }/* www .j a v a 2 s.com*/ return result.toString(); }
From source file:com.roncoo.pay.trade.utils.MerchantApiUtil.java
/** * ??/*from w w w . ja va2 s. co m*/ * @param paramMap * @return */ public static String getParamStr(Map<String, Object> paramMap) { SortedMap<String, Object> smap = new TreeMap<String, Object>(paramMap); StringBuffer stringBuffer = new StringBuffer(); for (Map.Entry<String, Object> m : smap.entrySet()) { Object value = m.getValue(); if (value != null && StringUtils.isNotBlank(String.valueOf(value))) { stringBuffer.append(m.getKey()).append("=").append(value).append("&"); } } stringBuffer.delete(stringBuffer.length() - 1, stringBuffer.length()); return stringBuffer.toString(); }
From source file:com.roncoo.pay.trade.utils.MerchantApiUtil.java
/** * ????//from w ww .ja v a2s .c o m * @param paramMap ??? * @param paySecret ?? * @return */ public static String getSign(Map<String, Object> paramMap, String paySecret) { SortedMap<String, Object> smap = new TreeMap<String, Object>(paramMap); StringBuffer stringBuffer = new StringBuffer(); for (Map.Entry<String, Object> m : smap.entrySet()) { Object value = m.getValue(); if (value != null && StringUtils.isNotBlank(String.valueOf(value))) { stringBuffer.append(m.getKey()).append("=").append(value).append("&"); } } stringBuffer.delete(stringBuffer.length() - 1, stringBuffer.length()); String argPreSign = stringBuffer.append("&paySecret=").append(paySecret).toString(); String signStr = MD5Util.encode(argPreSign).toUpperCase(); return signStr; }