{@inheritDoc}

@see jcifs.Encodable#encode(byte[], int)
7651
@Override
    public int encode ( byte[] dst, int dstIndex ) {
        int start = dstIndex;
        SMBUtil.writeInt8(this.allocationSize, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt8(this.endOfFile, dst, dstIndex);
        dstIndex += 8;
        SMBUtil.writeInt4(this.numberOfLinks, dst, dstIndex);
        dstIndex += 4;
        dst[ dstIndex++ ] = (byte) ( this.deletePending ? 1 : 0 );
        dst[ dstIndex++ ] = (byte) ( this.directory ? 1 : 0 );
        return dstIndex - start;
    }
1296080
@VisibleForTesting
  static void encode(TransactionEdit src, DataOutput out, TransactionEditCodec codec) throws IOException {
    out.writeByte(codec.getVersion());
    codec.encode(src, out);
  }
736696
public static byte[] encodeInteger(BigInteger bigInt) {
        if (bigInt == null) {
            throw new NullPointerException("encodeInteger called with null parameter");
        }
        return encodeBase64(toIntegerBytes(bigInt), false);
    }
1272210
@SuppressWarnings("StatementWithEmptyBody")
    public static String encode(final byte[] input) {
        ByteArrayInputStream in = new ByteArrayInputStream(input);
        StringBuilder sb = new StringBuilder();
        try {
            while (encodeChunk(sb, in)) {
                // do nothing
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }

        return sb.toString();
    }
1040073
public static String encodeX(byte[] a) {
	// check input
	if (a == null || a.length == 0) {
	    return "X''";
	}
	char[] out = new char[a.length * 2 + 3];
	int i = 2;
	for (int j = 0; j < a.length; j++) {
	    out[i++] = xdigits[(a[j] >> 4) & 0x0F];
	    out[i++] = xdigits[a[j] & 0x0F];
	}
	out[0] = 'X';
	out[1] = '\'';
	out[i] = '\'';
	return new String(out);
    }
1074541
public static String encode(byte[] bytes) {
		int bytesLength = bytes.length;
		int base64Length = (bytesLength * 4 + 2) / 3; // base64 encoded string length, without padding

		StringBuilder base64Builder = new StringBuilder();
		int bytesIndex = 0;

		while (bytesIndex < bytesLength) {
			int i0 = bytes[bytesIndex++] & 0xff;
			int i1 = bytesIndex < bytesLength ? bytes[bytesIndex++] & 0xff : 0;
			int i2 = bytesIndex < bytesLength ? bytes[bytesIndex++] & 0xff : 0;

			int o0 = i0 >>> 2;
			int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
			int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
			int o3 = i2 & 0x3F;

			base64Builder.append(NIBLES_2_CHARS[o0]);
			base64Builder.append(NIBLES_2_CHARS[o1]);
			base64Builder.append(base64Builder.length() < base64Length ? NIBLES_2_CHARS[o2] : '=');
			base64Builder.append(base64Builder.length() < base64Length ? NIBLES_2_CHARS[o3] : '=');
		}

		return base64Builder.toString();
	}
1193011
public void encode(OutputStream out) throws IOException {
        DerOutputStream tmp = new DerOutputStream();
        tmp.write(key.getEncoded());

        out.write(tmp.toByteArray());
    }
683937
private static byte[] writeInt(int value) throws IOException {
        byte[] b = new byte[4];

        b[0] = (byte) (value & 0x000000FF);
        b[1] = (byte) ((value & 0x0000FF00) >> 8);
        b[2] = (byte) ((value & 0x00FF0000) >> 16);
        b[3] = (byte) ((value & 0xFF000000) >> 24);

        return b;
    }
9538
public static void encode(byte[] dst, int offset, String s) {
        final int length = s.length();
        for (int i = 0; i < length; i++) {
            char ch = s.charAt(i);
            if (ch != 0 && ch <= 127) { // U+0000 uses two bytes.
                dst[offset++] = (byte) ch;
            } else if (ch <= 2047) {
                dst[offset++] = (byte) (0xc0 | (0x1f & (ch >> 6)));
                dst[offset++] = (byte) (0x80 | (0x3f & ch));
            } else {
                dst[offset++] = (byte) (0xe0 | (0x0f & (ch >> 12)));
                dst[offset++] = (byte) (0x80 | (0x3f & (ch >> 6)));
                dst[offset++] = (byte) (0x80 | (0x3f & ch));
            }
        }
    }
1346238
@Deprecated
    public static byte[] encodeToBytes(byte[] bytes)
    {
        try {
            char[] chars = Base64.encode(bytes);
            String string = new String(chars);
            return string.getBytes(DEFAULT_ENCODING);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
316289
public static String encodeB(byte[] bytes) {
		StringBuilder sb = new StringBuilder();

		int idx = 0;
		final int end = bytes.length;
		for (; idx < end - 2; idx += 3) {
			int data = (bytes[idx] & 0xff) << 16 | (bytes[idx + 1] & 0xff) << 8 | bytes[idx + 2] & 0xff;
			sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);
			sb.append((char) BASE64_TABLE[data >> 12 & 0x3f]);
			sb.append((char) BASE64_TABLE[data >> 6 & 0x3f]);
			sb.append((char) BASE64_TABLE[data & 0x3f]);
		}

		if (idx == end - 2) {
			int data = (bytes[idx] & 0xff) << 16 | (bytes[idx + 1] & 0xff) << 8;
			sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);
			sb.append((char) BASE64_TABLE[data >> 12 & 0x3f]);
			sb.append((char) BASE64_TABLE[data >> 6 & 0x3f]);
			sb.append((char) BASE64_PAD);

		} else if (idx == end - 1) {
			int data = (bytes[idx] & 0xff) << 16;
			sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);
			sb.append((char) BASE64_TABLE[data >> 12 & 0x3f]);
			sb.append((char) BASE64_PAD);
			sb.append((char) BASE64_PAD);
		}

		return sb.toString();
	}
1253576
@NotNull
    public static String encode(@NotNull byte[] source) {
        return encode(source, 0, source.length, ALPHABET, true);
    }
221729
public void encode(String string, OutputStream out) throws IOException {
  		encode(new ByteArrayInputStream(string.getBytes()),out);
	}
410747
public static String encode(byte[] bytes)
    {
        StringBuilder sb = new StringBuilder(bytes.length << 1);
        for (byte aByte : bytes)
        {
            sb.append(convertDigit(aByte >> 4));
            sb.append(convertDigit(aByte & 0x0f));
        }
        return sb.toString();
    }
686148
@Override
    protected final void encode(final ChannelHandlerContext ctx, final JNRPEResponse msg, final ByteBuf out) {
        out.writeBytes(msg.toByteArray());
    }
1051733
public byte[] encode(String s) throws IOException {
    if (s == null) {
      return null;
    }

    return s.getBytes(encoding);
  }
998325
@Override
  public void encode(ByteBuf buf) {
    Encoders.Strings.encode(buf, streamId);
    buf.writeLong(byteCount);
  }