public byte[] encode(char[] chars, int off, int len) {
    if (len == 0) {
      return new byte[0];
    }

    encoder.reset();

    int bytesLength = scale(len, encoder.maxBytesPerChar());

    byte[] bytes = ThreadLocalCache.getBytes(bytesLength);

    return encode(chars, off, len, bytes);
  }