Class VarByte

    • Constructor Detail

      • VarByte

        public VarByte()
    • Method Detail

      • New

        public static VarByte New()
      • New

        public static VarByte New​(int initialCapacity)
        Use this constructor only if really a specific size is needed or of the text to be handled is really big.
        Otherwise, use the factory methods as they are faster due to skipping capacity checks and bounds adjustment.

        Note that the given initialCapacity will still be adjusted to the next higher 2^n bounding value.

        Parameters:
        initialCapacity -
      • get

        public byte get​(int index)
      • lastByte

        public byte lastByte()
      • firstByte

        public byte firstByte()
      • length

        public int length()
      • subSequence

        public VarByte subSequence​(int start,
                                   int end)
      • add

        public VarByte add​(boolean b)
      • add

        public VarByte add​(byte c)
      • add

        public VarByte add​(short s)
      • add

        public VarByte add​(int i)
      • add

        public VarByte add​(long l)
      • add

        public VarByte add​(float f)
      • add

        public VarByte add​(double d)
      • add

        public VarByte add​(byte[] bytes)
      • ensureFreeCapacity

        public void ensureFreeCapacity​(int requiredFreeCapacity)
      • appendArray

        public VarByte appendArray​(byte... bytes)
      • append

        public VarByte append​(byte[] bytes)
      • append

        public VarByte append​(byte[] bytes,
                              int offset,
                              int length)
      • append

        public VarByte append​(byte value)
      • append

        public VarByte append​(boolean value)
      • append

        public VarByte append​(short value)
      • append

        public VarByte append​(char value)
      • append

        public VarByte append​(int value)
      • append

        public VarByte append​(float value)
      • append

        public VarByte append​(long value)
      • append

        public VarByte append​(double value)
      • setByte

        public VarByte setByte​(int index,
                               byte c)
      • setBytes

        public VarByte setBytes​(int index,
                                byte... c)
      • setLastByte

        public VarByte setLastByte​(byte c)
      • reverse

        public VarByte reverse()
      • surrogateByteReverse

        @Deprecated
        public VarByte surrogateByteReverse()
        Deprecated.
        not implemented yet. Currently just does reverse().
        Not implemented yet.
        Returns:
        currenty exactely what reverse() returns.
        See Also:
        reverse()
      • indexOf

        public int indexOf​(byte c)
      • indexOf

        public int indexOf​(byte c,
                           int fromIndex)
      • indexOf

        public int indexOf​(byte[] bytes)
      • indexOf

        public int indexOf​(byte[] bytes,
                           int offset)
      • contains

        public boolean contains​(byte c)
      • lastIndexOf

        public int lastIndexOf​(byte c)
      • lastIndexOf

        public int lastIndexOf​(byte c,
                               int fromIndex)
      • count

        public int count​(byte c)
      • deleteByteAt

        public VarByte deleteByteAt​(int index)
      • deleteLastByte

        public VarByte deleteLastByte()
      • deleteLast

        public VarByte deleteLast​(int n)
      • shrinkTo

        public VarByte shrinkTo​(int n)
      • toByteArray

        public byte[] toByteArray()
      • getBytes

        public void getBytes​(int srcBegin,
                             int srcEnd,
                             byte[] dst,
                             int dstBegin)
      • isEmpty

        public boolean isEmpty()
      • trimToSize

        public void trimToSize()
      • hasNoContent

        public static final boolean hasNoContent​(VarByte varByte)
        Parameters:
        varByte -
        Returns:
        true if varByte is either null or empty.
        See Also:
        isEmpty()
      • hasContent

        public static final boolean hasContent​(VarByte varByte)
      • replaceFirst

        public VarByte replaceFirst​(byte sample,
                                    byte replacement)
      • replaceFirst

        public VarByte replaceFirst​(int beginIndex,
                                    byte sample,
                                    byte replacement)
      • subsequence

        public VarByte subsequence​(int beginIndex,
                                   int endIndex)
      • clear

        public VarByte clear()
        Only preferable to reset() for security reasons.
      • reset

        public final VarByte reset()
      • truncate

        public void truncate()
      • repeat

        public VarByte repeat​(int amount,
                              byte b)