org.apache.hc.client5.http.utils

## Class ByteArrayBuilder

- java.lang.Object
- - org.apache.hc.client5.http.utils.ByteArrayBuilder

-     public final class ByteArrayBuilder
      extends Object

  Builder class for sequences of bytes.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteArrayBuilder()`
    `ByteArrayBuilder(int initialCapacity)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ByteArrayBuilder` | `append(byte[] b)`
    `ByteArrayBuilder` | `append(byte[] b, int off, int len)`
    `ByteArrayBuilder` | `append(char[] b)`
    `ByteArrayBuilder` | `append(char[] b, int off, int len)`
    `ByteArrayBuilder` | `append(CharBuffer charBuffer)`
    `ByteArrayBuilder` | `append(String s)`
    `int` | `capacity()`
    `ByteArrayBuilder` | `charset(Charset charset)`
    `void` | `ensureFreeCapacity(int freeCapacity)`
    `void` | `reset()`
    `byte[]` | `toByteArray()`
    `ByteBuffer` | `toByteBuffer()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### ByteArrayBuilder

          public ByteArrayBuilder()

    - #### ByteArrayBuilder

          public ByteArrayBuilder(int initialCapacity)

  - ### Method Detail

    - #### capacity

          public int capacity()

    - #### ensureFreeCapacity

          public void ensureFreeCapacity(int freeCapacity)

    - #### charset

          public ByteArrayBuilder charset(Charset charset)

    - #### append

          public ByteArrayBuilder append(byte[] b,
                                int off,
                                int len)

    - #### append

          public ByteArrayBuilder append(byte[] b)

    - #### append

          public ByteArrayBuilder append(CharBuffer charBuffer)

    - #### append

          public ByteArrayBuilder append(char[] b,
                                int off,
                                int len)

    - #### append

          public ByteArrayBuilder append(char[] b)

    - #### append

          public ByteArrayBuilder append(String s)

    - #### toByteBuffer

          public ByteBuffer toByteBuffer()

    - #### toByteArray

          public byte[] toByteArray()

    - #### reset

          public void reset()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.