List of usage examples for java.lang StringBuilder append
@Override public StringBuilder append(double d)
From source file:Main.java
private static String quoteString(String unquoted) { if (unquoted == null) return "null"; StringBuilder b = new StringBuilder(unquoted.length() + 2); b.append('"'); for (int i = 0; i < unquoted.length(); ++i) { char c = unquoted.charAt(i); if (c == '"' || c == '\\') b.append('\\'); b.append(c);// w w w . jav a 2 s . c o m } b.append('"'); return b.toString(); }
From source file:Main.java
private static String deriveLongerString(String str) { StringBuilder sb = new StringBuilder(str); StringBuilder builder = new StringBuilder(); builder.append(sb.toString().toLowerCase()); builder.append(sb.toString().toUpperCase()); StringBuilder result = new StringBuilder(); result.append(sb);//from w w w . ja v a2 s.c o m result.append(mix(builder.toString())); result.append(mix(builder.reverse().toString())); return result.toString(); }
From source file:com.barchart.netty.rest.server.util.SigningUtil.java
public static byte[] bytesToSign(final HttpServerRequest request) throws Exception { final ByteBuf content = request.getContent(); content.markReaderIndex();//from w w w . j a v a 2s .c om final byte[] contentBytes = IOUtils.toByteArray(new ByteBufInputStream(content)); content.resetReaderIndex(); final String md5 = KerberosUtilities.bytesToHex(MessageDigest.getInstance("MD5").digest(contentBytes)); final StringBuilder sb = new StringBuilder(); sb.append(request.getMethod().name()).append("\n").append(request.getUri()).append("\n").append(md5) .append("\n").append(nullCheck(request.headers().get(HttpHeaders.Names.CONTENT_TYPE))).append("\n") .append(nullCheck(request.headers().get(HttpHeaders.Names.DATE))).append("\n"); return sb.toString().getBytes("UTF-8"); }
From source file:com.rhc.dynamic.pipeline.utils.TestUtils.java
public static String getEmbeddedServerUrl(int port, String resource) { StringBuilder sb = new StringBuilder(); sb.append("http://localhost:"); sb.append(port);//w w w .j a v a2s .c o m sb.append("/"); sb.append(resource); return sb.toString(); }
From source file:Main.java
public static String generateRandomString(int len) { String str = "0123456789abcdefghijklmnopqrstuvwxyz"; Random rnd = new Random(); StringBuilder sb = new StringBuilder(len); for (int i = 0; i < len; i++) { sb.append(str.charAt(rnd.nextInt(str.length()))); }//from ww w . j ava 2s . c o m return sb.toString(); }