Appends the prettified multi-line hexadecimal dump of the specified {@link ByteBuf} to the specified
{@link StringBuilder} that is easy to read by humans.
11450
public static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf) {
        appendPrettyHexDump(dump, buf, buf.readerIndex(), buf.readableBytes());
    }
1091280
public static String prettyHexDump(ByteBuf buffer, int offset, int length) {
        return HexUtil.prettyHexDump(buffer, offset, length);
    }
548164
private static void appendEncoded(StringBuilder sb, String value) {
        for (char ch : value.toCharArray()) {
            if (isUnreserved(ch)) sb.append(ch);
            else appendEscapedByte(sb, (byte) ch);
        }
    }
429690
public void append(final byte[] a)
	{
		if(a == null) throw new NullPointerException();
		if(a.length == 0) return;
		
		if(a.length <= 8) {
			write(a, 0, a.length);		
		} else
		if((a.length <= 16) && (pos > 0) && ((buffer.length - pos) > a.length)) {
			write(a, 0, a.length);
		} else {
			flushBuffer();
			arrays.add(a);
			size += a.length;
		}
	}
1228085
@Override
    public Writer append(char c) throws IOException {
        singleCharBuffer[0]=(char)c;
        encodedAppender.append(encoder, null, singleCharBuffer, 0, 1);
        return this;
    }
249182
public static void toHex(byte b, Appendable buf) {
		try {
			int bi = _0XFF & b;
			int c = '0' + (bi / SIXTEEN) % SIXTEEN;
			if (c > '9') {
				c = 'A' + (c - '0' - TEN);
			}
			buf.append((char) c);
			c = '0' + bi % SIXTEEN;
			if (c > '9') {
				c = 'A' + (c - '0' - TEN);
			}
			buf.append((char) c);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
591568
private static StringConcatenationClient toStringConcatenation(final String... javaCodeLines) {
		return new StringConcatenationClient() {
			@Override
			protected void appendTo(StringConcatenationClient.TargetStringConcatenation builder) {
				for (final String line : javaCodeLines) {
					builder.append(line);
					builder.newLineIfNotEmpty();
				}
			}
		};
	}
85292
static void appendBytes(String content,
                          Mode mode,
                          BitArray bits,
                          String encoding) throws WriterException {
    switch (mode) {
      case NUMERIC:
        appendNumericBytes(content, bits);
        break;
      case ALPHANUMERIC:
        appendAlphanumericBytes(content, bits);
        break;
      case BYTE:
        append8BitBytes(content, bits, encoding);
        break;
      case KANJI:
        appendKanjiBytes(content, bits);
        break;
      default:
        throw new WriterException("Invalid mode: " + mode);
    }
  }
1127386
public static <T extends Appendable> T toHexStringPadded(T dst, byte[] src) {
        return toHexStringPadded(dst, src, 0, src.length);
    }
114168
static private void encodeBytes(byte previous, byte current, int byteIndex, StringBuilder output) {
        int chunk;
        int offset = byteIndex % 5;
        switch (offset) {
            case 0:
                chunk = ((current & 0xF8) >>> 3);
                output.append(lookupTable.charAt(chunk));
                break;
            case 1:
                chunk = (((previous & 0x07) << 2) | ((current & 0xC0) >>> 6));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x3E) >>> 1);
                output.append(lookupTable.charAt(chunk));
                break;
            case 2:
                chunk = (((previous & 0x01) << 4) | ((current & 0xF0) >>> 4));
                output.append(lookupTable.charAt(chunk));
                break;
            case 3:
                chunk = (((previous & 0x0F) << 1) | ((current & 0x80) >>> 7));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x7C) >>> 2);
                output.append(lookupTable.charAt(chunk));
                break;
            case 4:
                chunk = (((previous & 0x03) << 3) | ((current & 0xE0) >>> 5));
                output.append(lookupTable.charAt(chunk));
                chunk = (current & 0x1F);
                output.append(lookupTable.charAt(chunk));
                break;
        }
    }
1353045
public void append(final CharArrayBuffer b) {
        if (b == null) {
            return;
        }
        append(b.array,0, b.len);
    }
774879
public static String dumpString(byte[] b) {
    StringBuilder d = new StringBuilder(b.length * 2);
    for (byte aB : b) {
      char c = (char) aB;
      if (Character.isISOControl(c)) {
        switch (c) {
          case '\r':
            d.append("{CR}");
            break;
          case '\n':
            d.append("{LF}");
            break;
          case '\000':
            d.append("{NULL}");
            break;
          default:
            char hi = Character.forDigit((aB >> 4) & 0x0F, 16);
            char lo = Character.forDigit(aB & 0x0F, 16);
            d.append('[').append(Character.toUpperCase(hi)).append(Character.toUpperCase(lo)).append(']');
            break;
        }
      } else
        d.append(c);

    }
    return d.toString();
  }
804579
@Override
  public StringBuilder appendToBuffer(StringBuilder buf) {
    buf.append(super.getTask());
    if (isComplete()) {
      buf.append(": complete.");
    } else {
      buf.append(" #").append(getProcessed()+1).append('/').append(getTotal());
      buf.append(": ").append(getStepTitle());
    }
    buf.append('\n');
    return buf;
  }
825624
public static StringBuilder encodeHtml(StringBuilder buffer, CharSequence chars) {
		chars.chars().forEach(c -> {
			switch (c) {
			case '<':
				buffer.append("&lt;");
				break;
			case '>':
				buffer.append("&gt;");
				break;
			case '&':
				buffer.append("&amp;");
				break;
			case '"':
				buffer.append("&quot;");
				break;
			case '\'':
				buffer.append("&#39;");
				break;
			default:
				if (Character.isAlphabetic(c)) {
					buffer.append((char) c);
				} else {
					buffer.append("&#").append(c).append(';');
				}
			}
		});
		return buffer;
	}
139725
public final TextBuilder p(byte b) {
        if (null != __buffer) __append(b);
        else __caller.p(b);
        return this;
    }
13877
private static void appendToBuilder(long l, int radix, StringBuilder builder, char[] bufferConversion)
    {
        if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
        {
            radix = 10;
        }
        if (l == 0)
        {
            builder.append('0');
            return;
        }

        int count = 2;
        long j = l;
        boolean negative = l < 0;
        if (!negative)
        {
            count = 1;
            j = -l;
        }
        while ((l /= radix) != 0)
        {
            count++;
        }

        if (bufferConversion.length < count)
        {
            bufferConversion = new char[count];
        }
        int finalCount = count;

        char[] buffer = bufferConversion;
        do 
        {
            int ch = 0 - (int) (j % radix);
            if (ch > 9)
            {
                ch = ch - 10 + 'a';
            }
            else
            {
                ch += '0';
            }
            buffer[--count] = (char) ch;
            j /= radix;
        }
        while (j != 0);
        if (negative)
        {
            buffer[0] = '-';
        }
        for (int i = 0; i < finalCount; i++)
        {
            builder.append(buffer[i]);
        }
        //return new String(0, buffer.length, buffer);
    }
8883
public static void appendHex(StringBuilder builder, byte b, boolean toLowerCase) {
		final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
		
		int high = (b & 0xf0) >>> 4;//高位
		int low = b & 0x0f;//低位
		builder.append(toDigits[high]);
		builder.append(toDigits[low]);
	}