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

How to use
getChars
method
in
java.lang.StringBuilder

Best Java code snippets using java.lang.StringBuilder.getChars (Showing top 20 results out of 1,575)

origin: groovy/groovy-core

private static char[] getCharsFromStringBuilder(StringBuilder sbuf) {
  final int length = sbuf.length();
  char[] array2 = new char[length];
  sbuf.getChars(0, length, array2, 0);
  return array2;
}
origin: jfinal/jfinal

public Lexer(StringBuilder content, String fileName) {
  int len = content.length();
  buf = new char[len + 1];
  content.getChars(0, content.length(), buf, 0);
  buf[len] = EOF;
  this.fileName = fileName;
}
 
origin: neo4j/neo4j

  /**
   * Reads characters into an array.
   *
   * @param pos The position of this file to start reading from
   * @param cbuf Destination buffer
   * @param off Offset at which to start storing characters
   * @param len Maximum number of characters to read (> 0)
   * @return The number of characters read (0 if no characters remain)
   * @see java.io.Reader#read(char[], int, int)
   */
  public int read( int pos, char[] cbuf, int off, int len )
  {
    len = Math.min( content.length() - pos, len );
    content.getChars( pos, pos + len, cbuf, off );
    return len;
  }
}
origin: hankcs/HanLP

public char[] generateParameter(Table table, int current)
{
  StringBuilder sb = new StringBuilder();
  int i = 0;
  for (String d : delimiterList)
  {
    sb.append(d);
    int[] offset = offsetList.get(i++);
    sb.append(table.get(current + offset[0], offset[1]));
  }
  char[] o = new char[sb.length()];
  sb.getChars(0, sb.length(), o, 0);
  return o;
}
origin: robovm/robovm

/**
 * Creates a {@code String} from the contents of the specified {@code
 * StringBuilder}.
 *
 * @throws NullPointerException
 *             if {@code stringBuilder == null}.
 * @since 1.5
 */
public String(StringBuilder stringBuilder) {
  if (stringBuilder == null) {
    throw new NullPointerException("stringBuilder == null");
  }
  this.offset = 0;
  this.count = stringBuilder.length();
  this.value = new char[this.count];
  stringBuilder.getChars(0, this.count, this.value, 0);
}
origin: org.codehaus.plexus/plexus-utils

protected char[] getEscapeChars( boolean includeSingleQuote, boolean includeDoubleQuote )
{
  StringBuilder buf = new StringBuilder( 2 );
  if ( includeSingleQuote )
  {
    buf.append( '\'' );
  }
  if ( includeDoubleQuote )
  {
    buf.append( '\"' );
  }
  char[] result = new char[buf.length()];
  buf.getChars( 0, buf.length(), result, 0 );
  return result;
}
origin: jfinal/jfinal

public void write(StringBuilder stringBuilder, int offset, int len) throws IOException {
  while (len > chars.length) {
    write(stringBuilder, offset, chars.length);
    offset += chars.length;
    len -= chars.length;
  }
  
  stringBuilder.getChars(offset, offset + len, chars, 0);
  out.write(chars, 0, len);
}
 
origin: wildfly/wildfly

/**
 * Encode the given {@link Password} to a char array.
 *
 * @param password the password to encode
 * @return a char array representing the encoded password
 * @throws InvalidKeySpecException if the given password is not supported or could be encoded
 */
public static char[] encode(Password password) throws InvalidKeySpecException {
  StringBuilder b = getCryptStringToBuilder(password);
  char[] chars = new char[b.length()];
  b.getChars(0, b.length(), chars, 0);
  return chars;
}
origin: jfinal/jfinal

public char[] getChars() {
  if (chars != null) {
    return chars;
  }
  
  synchronized (this) {
    if (chars != null) {
      return chars;
    }
    
    if (content != null) {
      char[] charsTemp = new char[content.length()];
      content.getChars(0, content.length(), charsTemp, 0);
      chars = charsTemp;
      content = null;
      return chars;
    } else {
      String strTemp = new String(bytes, charset);
      char[] charsTemp = new char[strTemp.length()];
      strTemp.getChars(0, strTemp.length(), charsTemp, 0);
      chars = charsTemp;
      return chars;
    }
  }
}
 
origin: jfinal/jfinal

public void write(StringBuilder stringBuilder, int offset, int len) throws IOException {
  while (len > chars.length) {
    write(stringBuilder, offset, chars.length);
    offset += chars.length;
    len -= chars.length;
  }
  
  stringBuilder.getChars(offset, offset + len, chars, 0);
  int byteLen = encoder.encode(chars, 0, len, bytes);
  out.write(bytes, 0, byteLen);
}
 
origin: jfinal/jfinal

public ExprLexer(ParaToken paraToken, Location location) {
  this.location = location;
  StringBuilder content = paraToken.getContent();
  beginRow = paraToken.getRow();
  forwardRow = beginRow;
  if (content == null) {
    buf = new char[]{EOF};
    return ;
  }
  int len = content.length();
  buf = new char[len + 1];
  content.getChars(0, content.length(), buf, 0);
  buf[len] = EOF;
}
 
origin: redisson/redisson

p.getChars(p.length() - 3, p.length(), data, 0);
return f.append(data).toString();
origin: org.apache.lucene/lucene-core

@Override
public final CharTermAttribute append(StringBuilder s) {
 if (s == null) // needed for Appendable compliance
  return appendNull();
 final int len = s.length();
 s.getChars(0, len, resizeBuffer(termLength + len), termLength);
 termLength += len;
 return this;
}

origin: looly/hutool

  ((String) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuilder) {
  ((StringBuilder) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuffer) {
  ((StringBuffer) csq).getChars(0, len, this.value, index);
origin: looly/hutool

  ((String) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuilder) {
  ((StringBuilder) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuffer) {
  ((StringBuffer) csq).getChars(0, len, this.value, index);
origin: org.apache.commons/commons-lang3

/**
 * Appends a StringBuilder to this string builder.
 * Appending null will call {@link #appendNull()}.
 *
 * @param str the StringBuilder to append
 * @return this, to enable chaining
 * @since 3.2
 */
public StrBuilder append(final StringBuilder str) {
  if (str == null) {
    return appendNull();
  }
  final int strLen = str.length();
  if (strLen > 0) {
    final int len = length();
    ensureCapacity(len + strLen);
    str.getChars(0, strLen, buffer, len);
    size += strLen;
  }
  return this;
}
origin: org.pegdown/pegdown

public RootNode parseInternal(StringBuilderVar block) {
  char[] chars = block.getChars();
  int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices
  
  // strip out CROSSED_OUT characters and build index map
  StringBuilder clean = new StringBuilder();
  for (int i = 0; i < chars.length; i++) {
    char c = chars[i];
    if (c != CROSSED_OUT) {
      ixMap[clean.length()] = i;
      clean.append(c);
    }
  }
  ixMap[clean.length()] = chars.length;
  
  // run inner parse
  char[] cleaned = new char[clean.length()];
  clean.getChars(0, cleaned.length, cleaned, 0);
  RootNode rootNode = parseInternal(cleaned);
  
  // correct AST indices with index map
  fixIndices(rootNode, ixMap);
  
  return rootNode;
}
origin: jphp-group/jphp

  _pad = ' ';
prefix.getChars(0, _prefix.length, _prefix, 0);
origin: org.apache.commons/commons-lang3

/**
 * Appends part of a StringBuilder to this string builder.
 * Appending null will call {@link #appendNull()}.
 *
 * @param str the StringBuilder to append
 * @param startIndex the start index, inclusive, must be valid
 * @param length the length to append, must be valid
 * @return this, to enable chaining
 * @since 3.2
 */
public StrBuilder append(final StringBuilder str, final int startIndex, final int length) {
  if (str == null) {
    return appendNull();
  }
  if (startIndex < 0 || startIndex > str.length()) {
    throw new StringIndexOutOfBoundsException("startIndex must be valid");
  }
  if (length < 0 || (startIndex + length) > str.length()) {
    throw new StringIndexOutOfBoundsException("length must be valid");
  }
  if (length > 0) {
    final int len = length();
    ensureCapacity(len + length);
    str.getChars(startIndex, startIndex + length, buffer, len);
    size += length;
  }
  return this;
}
origin: org.apache.lucene/lucene-core

 ((String) csq).getChars(start, end, termBuffer, termLength);
} else if (csq instanceof StringBuilder) {
 ((StringBuilder) csq).getChars(start, end, termBuffer, termLength);
} else if (csq instanceof CharTermAttribute) {
 System.arraycopy(((CharTermAttribute) csq).buffer(), start, termBuffer, termLength, len);
java.langStringBuildergetChars

Popular methods of StringBuilder

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

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSupportFragmentManager (FragmentActivity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Reference (javax.naming)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for WebStorm
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