Class AppendableCharSequence

java.lang.Object
io.netty.util.internal.AppendableCharSequence
All Implemented Interfaces:
Appendable, CharSequence

public final class AppendableCharSequence extends Object implements CharSequence, Appendable
  • Field Details

    • chars

      private char[] chars
    • pos

      private int pos
  • Constructor Details

    • AppendableCharSequence

      public AppendableCharSequence(int length)
    • AppendableCharSequence

      private AppendableCharSequence(char[] chars)
  • Method Details

    • setLength

      public void setLength(int length)
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • charAtUnsafe

      public char charAtUnsafe(int index)
      Access a value in this CharSequence. This method is considered unsafe as index values are assumed to be legitimate. Only underlying array bounds checking is done.
      Parameters:
      index - The index to access the underlying array at.
      Returns:
      The value at index.
    • subSequence

      public AppendableCharSequence subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence
    • append

      public AppendableCharSequence append(char c)
      Specified by:
      append in interface Appendable
    • append

      public AppendableCharSequence append(CharSequence csq)
      Specified by:
      append in interface Appendable
    • append

      public AppendableCharSequence append(CharSequence csq, int start, int end)
      Specified by:
      append in interface Appendable
    • reset

      public void reset()
      Reset the AppendableCharSequence. Be aware this will only reset the current internal position and not shrink the internal char array.
    • toString

      public String toString()
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object
    • substring

      public String substring(int start, int end)
      Create a new String from the given start to end.
    • subStringUnsafe

      public String subStringUnsafe(int start, int end)
      Create a new String from the given start to end. This method is considered unsafe as index values are assumed to be legitimate. Only underlying array bounds checking is done.
    • expand

      private static char[] expand(char[] array, int neededSpace, int size)