Java Code Examples for com.intellij.util.text.CharArrayUtil#getChars()

The following examples show how to use com.intellij.util.text.CharArrayUtil#getChars() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FsRoot.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
protected char[] appendPathOnFileSystem(int pathLength, int[] position) {
  int myLength = myPathWithOneSlash.length() - 1;
  char[] chars = new char[pathLength + myLength];
  CharArrayUtil.getChars(myPathWithOneSlash, chars, 0, position[0], myLength);
  position[0] += myLength;
  return chars;
}
 
Example 2
Source File: LeafElement.java    From consulo with Apache License 2.0 5 votes vote down vote up
public int copyTo(@Nullable char[] buffer, int start) {
  final int length = myText.length();
  if (buffer != null) {
    CharArrayUtil.getChars(myText, buffer, start, length);
  }
  return start + length;
}
 
Example 3
Source File: LeafElement.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public char[] textToCharArray() {
  final char[] buffer = new char[myText.length()];
  CharArrayUtil.getChars(myText, buffer, 0);
  return buffer;
}
 
Example 4
Source File: LazyParseableElement.java    From consulo with Apache License 2.0 5 votes vote down vote up
public int copyTo(@Nullable char[] buffer, int start) {
  CharSequence text = myText();
  if (text == null) return -1;

  if (buffer != null) {
    CharArrayUtil.getChars(text, buffer, start);
  }
  return start + text.length();
}
 
Example 5
Source File: CharTableImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String createSequence(@Nonnull CharSequence text, int startOffset, int endOffset) {
  if (text instanceof String) {
    return ((String)text).substring(startOffset, endOffset);
  }
  char[] buf = new char[endOffset - startOffset];
  CharArrayUtil.getChars(text, buf, startOffset, 0, buf.length);
  return StringFactory.createShared(buf); // this way the .toString() doesn't create another instance (as opposed to new CharArrayCharSequence())
}
 
Example 6
Source File: VirtualFileSystemEntry.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static int copyString(@Nonnull char[] chars, int pos, @Nonnull CharSequence s) {
  int length = s.length();
  CharArrayUtil.getChars(s, chars, 0, pos, length);
  return pos + length;
}