public static String encode(UUID uuid) {
        Objects.requireNonNull(uuid, "uuid");

        final byte[] bytes = new byte[16];
        BytesUtils.writeLong(uuid.getMostSignificantBits(), bytes, 0);
        BytesUtils.writeLong(uuid.getLeastSignificantBits(), bytes, BytesUtils.LONG_BYTE_LENGTH);

        byte[] encode = ENCODER.encode(bytes);
        return new String(encode, ISO_8859);
    }
Base64 encodes the given {@code uuid} into URL and filename safe string as specified by RFC 4648 section 5.
The returned string is guaranteed to be 22 characters long (with 2 pad characters "=" removed) as a valid UUID
string will always be encoded into the same length.

@param uuid uuid to encode
@return URL and filename safe base64 encoded string with pad characters removed

@throws NullPointerException if {@code uuid} is null
@throws IllegalArgumentException if {@code uuid} is not a valid uuid
commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/name/Base64Utils.java