Package org.apache.groovy.json.internal

# Class Chr

java.lang.Object
org.apache.groovy.json.internal.Chr

public class Chr extends Object
Character array helpers used by the JSON internals.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Chr()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `_idx(char[] buffer, int location, byte[] chars)`
  Copies a byte array into a character buffer.
  `static void`
  `_idx(char[] buffer, int location, byte[] chars, int start, int end)`
  Copies part of a byte array into a character buffer.
  `static void`
  `_idx(char[] array, int startIndex, char[] input)`
  Copies a character array into another array.
  `static void`
  `_idx(char[] array, int startIndex, char[] input, int inputLength)`
  Copies a fixed number of characters into another array.
  `static char[]`
  `add(char[]... strings)`
  Concatenates all non-null arrays.
  `static char[]`
  `add(char[] array, char v)`
  Appends a character to a new array copy.
  `static char[]`
  `add(char[] array, char[] array2)`
  Concatenates two character arrays.
  `static char[]`
  `add(char[] array, String str)`
  Appends a string to a new array copy.
  `static char[]`
  `add(char[] array, StringBuilder stringBuilder)`
  Appends a `StringBuilder` to a new array copy.
  `static char[]`
  `array(char... array)`
  Returns the supplied characters as an array literal helper.
  `static char[]`
  `chars(String array)`
  Converts a string to a character array.
  `static boolean`
  `contains(char[] chars, char c, int start, int length)`
  Tests whether the supplied range contains a character.
  `static char[]`
  `copy(char[] array)`
  Copies an entire character array.
  `static char[]`
  `copy(char[] array, int offset, int length)`
  Copies a character range into a new array.
  `static char[]`
  `grow(char[] array)`
  Doubles the size of an array.
  `static char[]`
  `grow(char[] array, int size)`
  Grows an array by the supplied increment.
  `static boolean`
  `in(char value, char[] array)`
  Tests whether the supplied character occurs in the array.
  `static boolean`
  `in(char value, int offset, char[] array)`
  Tests whether the supplied character occurs in the array from the given offset.
  `static boolean`
  `in(char value, int offset, int end, char[] array)`
  Tests whether the supplied character occurs in the specified array range.
  `static boolean`
  `in(int value, char[] array)`
  Tests whether the supplied character code occurs in the array.
  `static char[]`
  `lpad(char[] in, int size, char pad)`
  Left-pads a character array to the requested size.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Chr

    public Chr()

- ## Method Details

  - ### array

    public static char[] array(char... array)
    Returns the supplied characters as an array literal helper.
    Parameters:
      `array` - the characters to return
    Returns:
      the supplied array

  - ### chars

    public static char[] chars(String array)
    Converts a string to a character array.
    Parameters:
      `array` - the string to convert
    Returns:
      the string characters

  - ### in

    public static boolean in(char value, char[] array)
    Tests whether the supplied character occurs in the array.
    Parameters:
      `value` - the character to find
      `array` - the array to scan
    Returns:
      `true` if the character is present

  - ### in

    public static boolean in(int value, char[] array)
    Tests whether the supplied character code occurs in the array.
    Parameters:
      `value` - the character code to find
      `array` - the array to scan
    Returns:
      `true` if the character is present

  - ### in

    public static boolean in(char value, int offset, char[] array)
    Tests whether the supplied character occurs in the array from the given offset.
    Parameters:
      `value` - the character to find
      `offset` - the inclusive scan start
      `array` - the array to scan
    Returns:
      `true` if the character is present

  - ### in

    public static boolean in(char value, int offset, int end, char[] array)
    Tests whether the supplied character occurs in the specified array range.
    Parameters:
      `value` - the character to find
      `offset` - the inclusive scan start
      `end` - the exclusive scan end
      `array` - the array to scan
    Returns:
      `true` if the character is present

  - ### grow

    public static char[] grow(char[] array, int size)
    Grows an array by the supplied increment.
    Parameters:
      `array` - the array to grow
      `size` - the number of extra slots to allocate
    Returns:
      the grown array

  - ### grow

    public static char[] grow(char[] array)
    Doubles the size of an array.
    Parameters:
      `array` - the array to grow
    Returns:
      the grown array

  - ### copy

    public static char[] copy(char[] array)
    Copies an entire character array.
    Parameters:
      `array` - the array to copy
    Returns:
      the copied array

  - ### copy

    public static char[] copy(char[] array, int offset, int length)
    Copies a character range into a new array.
    Parameters:
      `array` - the source array
      `offset` - the inclusive start index
      `length` - the number of characters to copy
    Returns:
      the copied range

  - ### add

    public static char[] add(char[] array, char v)
    Appends a character to a new array copy.
    Parameters:
      `array` - the source array
      `v` - the character to append
    Returns:
      the new array

  - ### add

    public static char[] add(char[] array, String str)
    Appends a string to a new array copy.
    Parameters:
      `array` - the source array
      `str` - the string to append
    Returns:
      the new array

  - ### add

    public static char[] add(char[] array, StringBuilder stringBuilder)
    Appends a `StringBuilder` to a new array copy.
    Parameters:
      `array` - the source array
      `stringBuilder` - the characters to append
    Returns:
      the new array

  - ### add

    public static char[] add(char[] array, char[] array2)
    Concatenates two character arrays.
    Parameters:
      `array` - the first array
      `array2` - the second array
    Returns:
      the concatenated array

  - ### lpad

    public static char[] lpad(char[] in, int size, char pad)
    Left-pads a character array to the requested size.
    Parameters:
      `in` - the input array
      `size` - the target size
      `pad` - the padding character
    Returns:
      the padded array, or the input if no padding is needed

  - ### contains

    public static boolean contains(char[] chars, char c, int start, int length)
    Tests whether the supplied range contains a character.
    Parameters:
      `chars` - the array to scan
      `c` - the character to find
      `start` - the inclusive scan start
      `length` - the number of characters to scan
    Returns:
      `true` if the character is present

  - ### _idx

    public static void _idx(char[] buffer, int location, byte[] chars)
    Copies a byte array into a character buffer.
    Parameters:
      `buffer` - the destination buffer
      `location` - the destination offset
      `chars` - the bytes to copy

  - ### _idx

    public static void _idx(char[] array, int startIndex, char[] input)
    Copies a character array into another array.
    Parameters:
      `array` - the destination array
      `startIndex` - the destination offset
      `input` - the characters to copy

  - ### _idx

    public static void _idx(char[] array, int startIndex, char[] input, int inputLength)
    Copies a fixed number of characters into another array.
    Parameters:
      `array` - the destination array
      `startIndex` - the destination offset
      `input` - the source characters
      `inputLength` - the number of characters to copy

  - ### _idx

    public static void _idx(char[] buffer, int location, byte[] chars, int start, int end)
    Copies part of a byte array into a character buffer.
    Parameters:
      `buffer` - the destination buffer
      `location` - the destination offset
      `chars` - the source bytes
      `start` - the inclusive source start
      `end` - the exclusive source end

  - ### add

    public static char[] add(char[]... strings)
    Concatenates all non-null arrays.
    Parameters:
      `strings` - the arrays to concatenate
    Returns:
      the concatenated array