java.lang.StringBuffer.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中java.lang.StringBuffer.<init>()方法的一些代码示例,展示了StringBuffer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringBuffer.<init>()方法的具体详情如下:
包路径:java.lang.StringBuffer
类名称:StringBuffer
方法名:<init>

StringBuffer.<init>介绍

[英]Constructs a string buffer with no characters in it and an initial capacity of 16 characters.
[中]构造一个字符串缓冲区,其中不包含任何字符,初始容量为16个字符。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
  public Object decode(Object jv) throws IOException {
    return new StringBuffer(jv.toString());
  }
};

代码示例来源:origin: apache/incubator-dubbo

@Override
  public Object decode(Object jv) throws IOException {
    return new StringBuffer(jv.toString());
  }
};

代码示例来源:origin: apache/incubator-dubbo

public static String generateGetMethodName(String fieldName) {
  return new StringBuffer(16)
      .append("get")
      .append(Character.toUpperCase(fieldName.charAt(0)))
      .append(fieldName.substring(1))
      .toString();
}

代码示例来源:origin: apache/incubator-dubbo

public static String generateGetMethodName(String fieldName) {
  return new StringBuffer(16)
      .append("get")
      .append(Character.toUpperCase(fieldName.charAt(0)))
      .append(fieldName.substring(1))
      .toString();
}

代码示例来源:origin: spring-projects/spring-framework

public StringBuffer getRequestUrl() {
  recalculatePathsIfNecessary();
  return new StringBuffer(this.requestUrl);
}

代码示例来源:origin: alibaba/druid

@Override
public String getBatchSql() {
  List<String> sqlList = getBatchSqlList();
  StringBuffer buf = new StringBuffer();
  for (String item : sqlList) {
    if (buf.length() > 0) {
      buf.append("\n;\n");
    }
    buf.append(item);
  }
  return buf.toString();
}

代码示例来源:origin: alibaba/druid

public String toString() {
  StringBuffer buf = new StringBuffer();
  output(buf);
  return buf.toString();
}

代码示例来源:origin: alibaba/druid

public String toString() {
  StringBuffer buf = new StringBuffer();
  output(buf);
  return buf.toString();
}

代码示例来源:origin: alibaba/druid

private String stmtId(StatementProxy statement) {
  StringBuffer buf = new StringBuffer();
  if (statement instanceof CallableStatementProxy) {
    buf.append("cstmt-");
  } else if (statement instanceof PreparedStatementProxy) {
    buf.append("pstmt-");
  } else {
    buf.append("stmt-");
  }
  buf.append(statement.getId());
  return buf.toString();
}

代码示例来源:origin: spring-projects/spring-framework

@Bean
  public StringBuffer baz() {
    return new StringBuffer("baz-child");
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Bean
  public StringBuffer baz() {
    return new StringBuffer("baz-parent");
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Bean
public StringBuffer foo() {
  return new StringBuffer("foo");
}

代码示例来源:origin: spring-projects/spring-framework

private static String format(String[] names) {
  StringBuffer sb = new StringBuffer();
  sb.append("(");
  for (int i = 0; i < names.length; i++) {
    sb.append(names[i]);
    if ((i + 1) < names.length) {
      sb.append(",");
    }
  }
  sb.append(")");
  return sb.toString();
}

代码示例来源:origin: libgdx/libgdx

public static void main (String[] args) {
  FileHandle file = new FileHandle(args[0]);
  StringBuffer list = new StringBuffer();
  args[0] = args[0].replace("\\", "/");
  if (!args[0].endsWith("/")) args[0] = args[0] + "/";
  traverse(file, args[0], list);
  new FileHandle(args[0] + "/assets.txt").writeString(list.toString(), false);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
  public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
    String s = (String) args[0];
    return new StringBuffer(s).reverse().toString();
  }
}

代码示例来源:origin: spring-projects/spring-framework

public String scramble(ProceedingJoinPoint pjp) throws Throwable {
  String message = (String) pjp.proceed();
  return new StringBuffer(message).reverse().toString();
}

代码示例来源:origin: google/guava

public void testIndexOf_genericPredicate() {
 List<CharSequence> sequences = Lists.newArrayList();
 sequences.add("bob");
 sequences.add(new StringBuilder("charlie"));
 sequences.add(new StringBuffer("henry"));
 sequences.add(new StringBuilder("apple"));
 sequences.add("lemon");
 assertEquals(3, Iterables.indexOf(sequences, STARTSWITH_A));
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public StringBuffer getRequestURL() {
  String scheme = getScheme();
  String server = getServerName();
  int port = getServerPort();
  String uri = getRequestURI();
  StringBuffer url = new StringBuffer(scheme).append("://").append(server);
  if (port > 0 && ((HTTP.equalsIgnoreCase(scheme) && port != 80) ||
      (HTTPS.equalsIgnoreCase(scheme) && port != 443))) {
    url.append(':').append(port);
  }
  if (StringUtils.hasText(uri)) {
    url.append(uri);
  }
  return url;
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void serializableMethodReplacerAndSuperclass() throws Exception {
  DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
  XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
  reader.loadBeanDefinitions(DELEGATION_OVERRIDES_CONTEXT);
  SerializableMethodReplacerCandidate s = (SerializableMethodReplacerCandidate) xbf.getBean("serializableReplacer");
  String forwards = "this is forwards";
  String backwards = new StringBuffer(forwards).reverse().toString();
  assertEquals(backwards, s.replaceMe(forwards));
  // SPR-356: lookup methods & method replacers are not serializable.
  assertFalse(
      "Lookup methods and method replacers are not meant to be serializable.",
      SerializationTestUtils.isSerializable(s));
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void testBindingWithMultipleArgsDifferentlyOrdered() {
  ManyValuedArgs target = new ManyValuedArgs();
  ManyValuedArgs mva = (ManyValuedArgs) createProxy(target,
      getFixture().getAdvisors(
          new SingletonMetadataAwareAspectInstanceFactory(new ManyValuedArgs(), "someBean")),
      ManyValuedArgs.class);
  String a = "a";
  int b = 12;
  int c = 25;
  String d = "d";
  StringBuffer e = new StringBuffer("stringbuf");
  String expectedResult = a + b+ c + d + e;
  assertEquals(expectedResult, mva.mungeArgs(a, b, c, d, e));
}

相关文章