Encodes the specified range of the specified byte array, and returns the encoded
{@code String}.
499875
public final String encode(byte[] bytes, int off, int len) {
    checkNotNull(bytes);
    checkPositionIndexes(off, off + len, bytes.length);
    CharOutput result = stringBuilderOutput(maxEncodedSize(len));
    ByteOutput byteOutput = encodingStream(result);
    try {
      for (int i = 0; i < len; i++) {
        byteOutput.write(bytes[off + i]);
      }
      byteOutput.close();
    } catch (IOException impossible) {
      throw new AssertionError("impossible");
    }
    return result.toString();
  }
909555
static public String encode(byte[] bytes, String indentation) {
        StringBuilder result = new StringBuilder();
        int length = bytes.length;
        if (length == 0) return "";  // empty byte array
        if (indentation != null) result.append(indentation);
        encodeBytes(bytes[0], bytes[0], 0, result);
        for (int i = 1; i < length; i++) {
            if (i % 50 == 0) {
                // format to indented 80 character blocks
                result.append("\n");
                if (indentation != null) result.append(indentation);
            }
            encodeBytes(bytes[i - 1], bytes[i], i, result);
        }
        encodeLastByte(bytes[length - 1], length - 1, result);
        return result.toString();
    }
741645
public static String encode(byte[] source) {
        byte[] encoded = encodeBytesToBytes( source, source.length);

        try {
            return new String(encoded, "US-ASCII");
        }
        catch (java.io.UnsupportedEncodingException uue) {
            return new String( encoded );
        }
    }
80682
private void encodeThis() throws IOException {
        DerOutputStream os = new DerOutputStream();
        os.putTruncatedUnalignedBitString(new BitArray(this.bitString));
        this.extensionValue = os.toByteArray();
    }
422804
public static String encodeBytes(byte[] bytes)
    {
        String ret = null;

        try
        {
            // Obfuscate the string
            if(bytes != null)
                ret = new String(Base64.encodeBase64(bytes));
        }
        catch(NoClassDefFoundError e)
        {
            ret = new String(bytes);
            System.out.println("WARNING: unable to encode: "
                +e.getClass().getName()+": "+e.getMessage());
        }

        return ret;
    }
1005498
void encode() {
        final int bwtLength = this.bwtLength;
        final boolean[] bwtValuesPresent = this.bwtValuesPresent;
        final int[] bwtBlock = this.bwtBlock;
        final char[] mtfBlock = this.mtfBlock;
        final int[] mtfSymbolFrequencies = this.mtfSymbolFrequencies;
        final byte[] huffmanSymbolMap = new byte[256];
        final Bzip2MoveToFrontTable symbolMTF = new Bzip2MoveToFrontTable();

        int totalUniqueValues = 0;
        for (int i = 0; i < huffmanSymbolMap.length; i++) {
            if (bwtValuesPresent[i]) {
                huffmanSymbolMap[i] = (byte) totalUniqueValues++;
            }
        }
        final int endOfBlockSymbol = totalUniqueValues + 1;

        int mtfIndex = 0;
        int repeatCount = 0;
        int totalRunAs = 0;
        int totalRunBs = 0;
        for (int i = 0; i < bwtLength; i++) {
            // Move To Front
            final int mtfPosition = symbolMTF.valueToFront(huffmanSymbolMap[bwtBlock[i] & 0xff]);
            // Run Length Encode
            if (mtfPosition == 0) {
                repeatCount++;
            } else {
                if (repeatCount > 0) {
                    repeatCount--;
                    while (true) {
                        if ((repeatCount & 1) == 0) {
                            mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNA;
                            totalRunAs++;
                        } else {
                            mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNB;
                            totalRunBs++;
                        }

                        if (repeatCount <= 1) {
                            break;
                        }
                        repeatCount = (repeatCount - 2) >>> 1;
                    }
                    repeatCount = 0;
                }
                mtfBlock[mtfIndex++] = (char) (mtfPosition + 1);
                mtfSymbolFrequencies[mtfPosition + 1]++;
            }
        }

        if (repeatCount > 0) {
            repeatCount--;
            while (true) {
                if ((repeatCount & 1) == 0) {
                    mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNA;
                    totalRunAs++;
                } else {
                    mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNB;
                    totalRunBs++;
                }

                if (repeatCount <= 1) {
                    break;
                }
                repeatCount = (repeatCount - 2) >>> 1;
            }
        }

        mtfBlock[mtfIndex] = (char) endOfBlockSymbol;
        mtfSymbolFrequencies[endOfBlockSymbol]++;
        mtfSymbolFrequencies[HUFFMAN_SYMBOL_RUNA] += totalRunAs;
        mtfSymbolFrequencies[HUFFMAN_SYMBOL_RUNB] += totalRunBs;

        mtfLength = mtfIndex + 1;
        alphabetSize = endOfBlockSymbol + 1;
    }
1325801
static public String encode(byte[] bytes, String indentation) {
        StringBuilder result = new StringBuilder();
        int length = bytes.length;
        if (length == 0) return "";  // empty byte array
        if (indentation != null) result.append(indentation);
        encodeByte(bytes, 0, result);
        for (int i = 1; i < length; i++) {
            if (i % 40 == 0) {
                // format to indented 80 character blocks
                result.append("\n");
                if (indentation != null) result.append(indentation);
            }
            encodeByte(bytes, i, result);
        }
        return result.toString();
    }
952824
public static String toUTF(byte[] bytes) {
    int codePoint = ByteBuffer.wrap(bytes).getInt();
    if (codePoint < 0 || codePoint > 0X10FFFF)
      throw new IllegalArgumentException(
          "RangeError: pack(U): value out of range");

    return String.valueOf((char) codePoint);
  }
420917
public static String encodeBytesToString(byte bytes[]) {
    StringBuilder string = new StringBuilder(bytes.length * 2);
    for (int i = 0; i < bytes.length; i++) {
      // look up high nibble char
      string.append(hexChar[(bytes[i] & 0xf0) >>> 4]);
      // look up low nibble char
      string.append(hexChar[bytes[i] & 0x0f]);
    }
    return string.toString();
  }
882649
public static byte[] encode(final byte[] data) throws IOException {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        GZIPOutputStream gzOut = null;
        try {
            gzOut = new GZIPOutputStream(byteOut);
            gzOut.write(data);
            gzOut.close();
            byteOut.close();
            return byteOut.toByteArray();
        } finally {
            gzOut.close();
            byteOut.close();
        }
    }
1193854
public static String encode(byte[] bytes) {
	String retorno = "";
	if (bytes == null || bytes.length == 0) {
	    return retorno;
	}
	for (int i = 0; i < bytes.length; i++) {
	    byte valor = bytes[i];
	    int d1 = valor & 0xF;
	    d1 += (d1 < 10) ? 48 : 55;
	    int d2 = (valor & 0xF0) >> 4;
	    d2 += (d2 < 10) ? 48 : 55;
	    retorno = retorno + (char) d2 + (char) d1;
	}
	return retorno;
    }
1290405
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;

        System.arraycopy(this.sourceKey, 0, dst, dstIndex, 24);
        dstIndex += 24;

        SMBUtil.writeInt4(this.chunks.length, dst, dstIndex);
        dstIndex += 4;

        dstIndex += 4; // Reserved

        for ( SrvCopychunk chk : this.chunks ) {
            dstIndex += chk.encode(dst, dstIndex);
        }
        return dstIndex - start;
    }
142347
private String encodeBytes(byte[] cipherText) {
        StringBuffer cipherStringBuffer = new StringBuffer();
        for (int i = 0; i < cipherText.length; i++) {
            byte b = cipherText[i];
            cipherStringBuffer.append(Byte.toString(b) + ":");
        }
        return cipherStringBuffer.toString();
    }
1272528
public static String encodeByteArray(byte[] byteArray) {
		try {
			return new String(Base64.encodeBase64(byteArray), UTF8_ENCODING);
		} catch(UnsupportedEncodingException e) {
			throw new MappingException("Could not encode byteArray to UTF8 encoding", e);
		}
	}
293281
private static void encodeCopy(ByteBuf out, int offset, int length) {
        while (length >= 68) {
            encodeCopyWithOffset(out, offset, 64);
            length -= 64;
        }

        if (length > 64) {
            encodeCopyWithOffset(out, offset, 60);
            length -= 60;
        }

        encodeCopyWithOffset(out, offset, length);
    }
618832
protected String decode(byte[] bytes, String encoding) {

        try {
            return new String(bytes, encoding);
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }
69115
public static String encode(byte[] from) {
        StringBuilder to = new StringBuilder((int) (from.length * 1.34) + 3);
        int num = 0;
        char currentByte = 0;
        for (int i = 0; i < from.length; i++) {
            num = num % 8;
            while (num < 8) {
                switch (num) {
                    case 0:
                        currentByte = (char) (from[i] & lead6byte);
                        currentByte = (char) (currentByte >>> 2);
                        break;
                    case 2:
                        currentByte = (char) (from[i] & last6byte);
                        break;
                    case 4:
                        currentByte = (char) (from[i] & last4byte);
                        currentByte = (char) (currentByte << 2);
                        if ((i + 1) < from.length) {
                            currentByte |= (from[i + 1] & lead2byte) >>> 6;
                        }
                        break;
                    case 6:
                        currentByte = (char) (from[i] & last2byte);
                        currentByte = (char) (currentByte << 4);
                        if ((i + 1) < from.length) {
                            currentByte |= (from[i + 1] & lead4byte) >>> 4;
                        }
                        break;
                    default:
                        break;
                }
                to.append(encodeTable[currentByte]);
                num += 6;
            }
        }
        if (to.length() % 4 != 0) {
            for (int i = 4 - to.length() % 4; i > 0; i--) {
                to.append("=");
            }
        }
        return to.toString();
    }