Tabnine Logo
StringBuilder.setLength
Code IndexAdd Tabnine to your IDE (free)

How to use
setLength
method
in
java.lang.StringBuilder

Best Java code snippets using java.lang.StringBuilder.setLength (Showing top 20 results out of 33,174)

origin: spring-projects/spring-framework

public void write(char ch) {
  if (ch == '\n' && this.buffer.length() > 0) {
    logger.debug(this.buffer.toString());
    this.buffer.setLength(0);
  }
  else {
    this.buffer.append(ch);
  }
}
origin: apache/incubator-dubbo

public void write(char ch) {
  if (ch == '\n' && _sb.length() > 0) {
    _log.log(_level, _sb.toString());
    _sb.setLength(0);
  } else
    _sb.append((char) ch);
}
origin: apache/incubator-dubbo

@Override
public void write(char[] buffer, int offset, int length) {
  for (int i = 0; i < length; i++) {
    char ch = buffer[offset + i];
    if (ch == '\n' && _sb.length() > 0) {
      _log.log(_level, _sb.toString());
      _sb.setLength(0);
    } else
      _sb.append((char) ch);
  }
}
origin: apache/incubator-dubbo

public void write(char ch) {
  if (ch == '\n' && _sb.length() > 0) {
    _log.log(_level, _sb.toString());
    _sb.setLength(0);
  } else
    _sb.append((char) ch);
}
origin: apache/incubator-dubbo

@Override
public void write(char[] buffer, int offset, int length) {
  for (int i = 0; i < length; i++) {
    char ch = buffer[offset + i];
    if (ch == '\n' && _sb.length() > 0) {
      _log.log(_level, _sb.toString());
      _sb.setLength(0);
    } else
      _sb.append((char) ch);
  }
}
origin: spring-projects/spring-framework

@Override
public void write(char[] buffer, int offset, int length) {
  for (int i = 0; i < length; i++) {
    char ch = buffer[offset + i];
    if (ch == '\n' && this.buffer.length() > 0) {
      logger.debug(this.buffer.toString());
      this.buffer.setLength(0);
    }
    else {
      this.buffer.append(ch);
    }
  }
}
origin: square/okhttp

Entry(String key) {
 this.key = key;
 lengths = new long[valueCount];
 cleanFiles = new File[valueCount];
 dirtyFiles = new File[valueCount];
 // The names are repetitive so re-use the same builder to avoid allocations.
 StringBuilder fileBuilder = new StringBuilder(key).append('.');
 int truncateTo = fileBuilder.length();
 for (int i = 0; i < valueCount; i++) {
  fileBuilder.append(i);
  cleanFiles[i] = new File(directory, fileBuilder.toString());
  fileBuilder.append(".tmp");
  dirtyFiles[i] = new File(directory, fileBuilder.toString());
  fileBuilder.setLength(truncateTo);
 }
}
origin: netty/netty

public StringBuilder stringBuilder() {
  StringBuilder sb = stringBuilder;
  if (sb == null) {
    return stringBuilder = new StringBuilder(STRING_BUILDER_INITIAL_SIZE);
  }
  if (sb.capacity() > STRING_BUILDER_MAX_SIZE) {
    sb.setLength(STRING_BUILDER_INITIAL_SIZE);
    sb.trimToSize();
  }
  sb.setLength(0);
  return sb;
}
origin: libgdx/libgdx

/** Returns a description of the actor hierarchy, recursively. */
public String toString () {
  StringBuilder buffer = new StringBuilder(128);
  toString(buffer, 1);
  buffer.setLength(buffer.length() - 1);
  return buffer.toString();
}
origin: libgdx/libgdx

@Override
public void println (String s) {
  buf.append(s);
  consoleLog(buf.toString());
  buf.setLength(0);
}
origin: libgdx/libgdx

@Override
public void println (String s) {
  buf.append(s);
  consoleLog(buf.toString());
  buf.setLength(0);
}
origin: libgdx/libgdx

/** Returns a description of the actor hierarchy, recursively. */
public String toString () {
  StringBuilder buffer = new StringBuilder(128);
  toString(buffer, 1);
  buffer.setLength(buffer.length() - 1);
  return buffer.toString();
}
origin: netty/netty

public void reset() {
  timeFound = false;
  hours = -1;
  minutes = -1;
  seconds = -1;
  dayOfMonthFound = false;
  dayOfMonth = -1;
  monthFound = false;
  month = -1;
  yearFound = false;
  year = -1;
  cal.clear();
  sb.setLength(0);
}
origin: jenkinsci/jenkins

@Override
public String nextToken(String delim)
  throws NoSuchElementException
{
  _delim=delim;
  _i=_lastStart;
  _token.setLength(0);
  _hasToken=false;
  return nextToken();
}
origin: jenkinsci/jenkins

@Override
public String nextToken()
  throws NoSuchElementException
{
  if (!hasMoreTokens() || _token==null)
    throw new NoSuchElementException();
  String t=_token.toString();
  _token.setLength(0);
  _hasToken=false;
  return t;
}
origin: libgdx/libgdx

  @Override
  public String toString () {
    stringBuilder.setLength(0);
    for (final ObjectMap.Entry<String, ObjectMap<String, String>> entry : snippets.entries()) {
      stringBuilder.append(entry.key).append(": {");
      for (final String snipname : entry.value.keys())
        stringBuilder.append(snipname).append(", ");
      stringBuilder.append("}\n");
    }
    return stringBuilder.toString();
  }
}
origin: netty/netty

  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(super.toString());
    buf.setLength(buf.length() - 1);
    buf.append(", resolver: ").append(resolver());
    SocketAddress remoteAddress = remoteAddress();
    if (remoteAddress != null) {
      buf.append(", remoteAddress: ")
          .append(remoteAddress);
    }
    return buf.append(')').toString();
  }
}
origin: libgdx/libgdx

public ShaderProgram load (String vertex, String fragment) {
  StringBuilder out = new StringBuilder();
  load(out, vertex);
  vertex = out.toString();
  includes.clear();
  out.setLength(0);
  load(out, fragment);
  fragment = out.toString();
  includes.clear();
  return new ShaderProgram(vertex, fragment);
}
origin: libgdx/libgdx

public void render (boolean update) {
  fpsCounter.put(Gdx.graphics.getFramesPerSecond());
  if (update) update();
  beginRender(true);
  renderWorld();
  Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
  if (debugMode != DebugDrawModes.DBG_NoDebug) world.setDebugMode(debugMode);
  Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
  performance.setLength(0);
  performance.append("FPS: ").append(fpsCounter.value).append(", Bullet: ")
    .append((int)(performanceCounter.load.value * 100f)).append("%");
}
origin: spring-projects/spring-framework

  @Override
  public Mono<Void> render(@Nullable Map<String, ?> model, @Nullable MediaType contentType,
      ServerWebExchange exchange) {
    StringBuilder builder = new StringBuilder();
    builder.append("name=").append(this.name).append('\n');
    for (Map.Entry<String, ?> entry : model.entrySet()) {
      builder.append(entry.getKey()).append('=').append(entry.getValue()).append('\n');
    }
    builder.setLength(builder.length() - 1);
    byte[] bytes = builder.toString().getBytes(StandardCharsets.UTF_8);
    ServerHttpResponse response = exchange.getResponse();
    DataBuffer buffer = response.bufferFactory().wrap(bytes);
    response.getHeaders().setContentType(MediaType.TEXT_PLAIN);
    return response.writeWith(Mono.just(buffer));
  }
}
java.langStringBuildersetLength

Javadoc

Sets the length of this string buffer.

Popular methods of StringBuilder

  • append
  • toString
  • <init>
    Constructs a string builder initialized to the contents of the specified string. The initial capacit
  • length
  • charAt
  • deleteCharAt
  • insert
  • substring
  • delete
  • replace
  • setCharAt
  • indexOf
  • setCharAt,
  • indexOf,
  • lastIndexOf,
  • reverse,
  • appendCodePoint,
  • getChars,
  • subSequence,
  • ensureCapacity,
  • trimToSize

Popular in Java

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • setContentView (Activity)
  • getContentResolver (Context)
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Notification (javax.management)
  • BoxLayout (javax.swing)
  • JButton (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now