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

How to use
getChars
method
in
java.lang.String

Best Java code snippets using java.lang.String.getChars (Showing top 20 results out of 8,865)

origin: alibaba/druid

public final char[] sub_chars(int offset, int count) {
  char[] chars = new char[count];
  text.getChars(offset, offset + count, chars, 0);
  return chars;
}
origin: alibaba/druid

public void arraycopy(int srcPos, char[] dest, int destPos, int length) {
  text.getChars(srcPos, srcPos + length, dest, destPos);
}
origin: alibaba/druid

private static String subString(String src, int offset, int len) {
  char[] chars = new char[len];
  src.getChars(offset, offset + len, chars, 0);
  return new String(chars);
}
origin: libgdx/libgdx

/** Constructs an instance that's initialized with the contents of the specified {@code String}. The capacity of the new
 * builder will be the length of the {@code String} plus 16.
 * 
 * @param string the {@code String} to copy into the builder.
 * @throws NullPointerException if {@code str} is {@code null}. */
public StringBuilder (String string) {
  length = string.length();
  chars = new char[length + INITIAL_CAPACITY];
  string.getChars(0, length, chars, 0);
}
origin: libgdx/libgdx

/** Constructs an instance that's initialized with the contents of the specified {@code String}. The capacity of the new
 * builder will be the length of the {@code String} plus 16.
 * 
 * @param string the {@code String} to copy into the builder.
 * @throws NullPointerException if {@code str} is {@code null}. */
public StringBuilder (String string) {
  length = string.length();
  chars = new char[length + INITIAL_CAPACITY];
  string.getChars(0, length, chars, 0);
}
origin: stackoverflow.com

 int reuseBuffMethod(final char[] reusable, final String data) {
  final int len = data.length();
  data.getChars(0, len, reusable, 0);
  for (int i = 0; i < len; i++) {
    if (reusable[i] <= ' ') {
      doThrow();
    }
  }
  return len;
}
origin: prestodb/presto

private static int _outputSmallestL(char[] b, int off)
{
  int len = SMALLEST_LONG.length();
  SMALLEST_LONG.getChars(0, len, b, off);
  return (off + len);
}
origin: prestodb/presto

@Override
public int appendUnquoted(char[] buffer, int offset) {
  String str = _value;
  final int length = str.length();
  if ((offset + length) > buffer.length) {
    return -1;
  }
  str.getChars(0,  length, buffer, offset);
  return length;
}
origin: prestodb/presto

private static int _outputSmallestI(char[] b, int off)
{
  int len = SMALLEST_INT.length();
  SMALLEST_INT.getChars(0, len, b, off);
  return (off + len);
}
origin: redisson/redisson

private static int _outputSmallestI(char[] b, int off)
{
  int len = SMALLEST_INT.length();
  SMALLEST_INT.getChars(0, len, b, off);
  return (off + len);
}
origin: apache/incubator-dubbo

@Override
public int read(char[] cs, int off, int len) throws IOException {
  ensureOpen();
  if ((off < 0) || (off > cs.length) || (len < 0) ||
      ((off + len) > cs.length) || ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
  if (len == 0) {
    return 0;
  }
  if (mPosition >= mLimit) {
    return -1;
  }
  int n = Math.min(mLimit - mPosition, len);
  mString.getChars(mPosition, mPosition + n, cs, off);
  mPosition += n;
  return n;
}
origin: apache/incubator-dubbo

@Override
public int read(char[] cs, int off, int len) throws IOException {
  ensureOpen();
  if ((off < 0) || (off > cs.length) || (len < 0) ||
      ((off + len) > cs.length) || ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
  if (len == 0) {
    return 0;
  }
  if (mPosition >= mLimit) {
    return -1;
  }
  int n = Math.min(mLimit - mPosition, len);
  mString.getChars(mPosition, mPosition + n, cs, off);
  mPosition += n;
  return n;
}
origin: libgdx/libgdx

public final CharBuffer get (char[] dest, int off, int len) {
  int length = dest.length;
  if ((off < 0) || (len < 0) || (long)off + (long)len > length) {
    throw new IndexOutOfBoundsException();
  }
  if (len > remaining()) {
    throw new BufferUnderflowException();
  }
  int newPosition = position + len;
  sequence.toString().getChars(position, newPosition, dest, off);
  position = newPosition;
  return this;
}
origin: libgdx/libgdx

public final CharBuffer get (char[] dest, int off, int len) {
  int length = dest.length;
  if ((off < 0) || (len < 0) || (long)off + (long)len > length) {
    throw new IndexOutOfBoundsException();
  }
  if (len > remaining()) {
    throw new BufferUnderflowException();
  }
  int newPosition = position + len;
  sequence.toString().getChars(position, newPosition, dest, off);
  position = newPosition;
  return this;
}
origin: libgdx/libgdx

final void append0 (String string) {
  if (string == null) {
    appendNull();
    return;
  }
  int adding = string.length();
  int newSize = length + adding;
  if (newSize > chars.length) {
    enlargeBuffer(newSize);
  }
  string.getChars(0, adding, chars, length);
  length = newSize;
}
origin: libgdx/libgdx

final void append0 (String string) {
  if (string == null) {
    appendNull();
    return;
  }
  int adding = string.length();
  int newSize = length + adding;
  if (newSize > chars.length) {
    enlargeBuffer(newSize);
  }
  string.getChars(0, adding, chars, length);
  length = newSize;
}
origin: libgdx/libgdx

final void insert0 (int index, String string) {
  if (0 <= index && index <= length) {
    if (string == null) {
      string = "null";
    }
    int min = string.length();
    if (min != 0) {
      move(min, index);
      string.getChars(0, min, chars, index);
      length += min;
    }
  } else {
    throw new StringIndexOutOfBoundsException(index);
  }
}
origin: prestodb/presto

@Override
public void writeRaw(String text) throws IOException {
  final int len = text.length();
  final char[] buf = _charBuffer;
  if (len <= buf.length) {
    text.getChars(0, len, buf, 0);
    writeRaw(buf, 0, len);
  } else {
    writeRaw(text, 0, len);
  }
}
origin: libgdx/libgdx

final void insert0 (int index, String string) {
  if (0 <= index && index <= length) {
    if (string == null) {
      string = "null";
    }
    int min = string.length();
    if (min != 0) {
      move(min, index);
      string.getChars(0, min, chars, index);
      length += min;
    }
  } else {
    throw new StringIndexOutOfBoundsException(index);
  }
}
origin: redisson/redisson

@Override
public void writeStringUTF(String str) throws IOException {
  final int strlen = str.length();
  writeFInt(strlen);
  ensureFree(strlen*2);
  char c[] = getCharBuf(strlen);
  str.getChars(0,strlen,c,0);
  buffout.setChar(pos,c,0,strlen);
  pos += strlen*2;
}
java.langStringgetChars

Javadoc

Copies characters from this string into the destination character array.

The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1 (thus the total number of characters to be copied is srcEnd-srcBegin). The characters are copied into the subarray of dst starting at index dstBegin and ending at index:

 
dstbegin + (srcEnd-srcBegin) - 1 

Popular methods of String

  • equals
  • length
    Returns the number of characters in this string.
  • substring
    Returns a string containing a subsequence of characters from this string. The returned string shares
  • startsWith
    Compares the specified string to this string, starting at the specified offset, to determine if the
  • format
    Returns a formatted string, using the supplied format and arguments, localized to the given locale.
  • split
    Splits this string using the supplied regularExpression. See Pattern#split(CharSequence,int) for an
  • trim
  • valueOf
    Creates a new string containing the specified characters in the character array. Modifying the chara
  • indexOf
  • endsWith
    Compares the specified string to this string to determine if the specified string is a suffix.
  • toLowerCase
    Converts this string to lower case, using the rules of locale.Most case mappings are unaffected by t
  • contains
    Determines if this String contains the sequence of characters in the CharSequence passed.
  • toLowerCase,
  • contains,
  • getBytes,
  • <init>,
  • equalsIgnoreCase,
  • replace,
  • isEmpty,
  • charAt,
  • hashCode,
  • lastIndexOf

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • CodeWhisperer alternatives
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