Creates an input source for the given byte data and system id.<p>

@param data the data which the input source should return
@param systemId the system id for the input source

@return the input source
15192
InputSource createInputSource(byte[] data, String systemId) {

        InputSource result = new InputSource(new ByteArrayInputStream(data));
        result.setSystemId(systemId);
        return result;
    }
904908
public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
        YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlBytes);
        return createDataSource(config.getDataSources(), config.getShardingRule(), config.getProps(), config.getOrchestration());
    }
547449
public static String encode(byte[] data)
  {
	  StringBuffer result = new StringBuffer();

    for (int i = 0; i < data.length; i++) {
	    result.append(trans[(data[i] >> 4) & 0xf]);
	    result.append(trans[data[i] & 0xf]);
	  }

    return result.toString();
  }
293238
public static StringBuffer encode(byte[] data)
	{
		int rem = data.length % 3;
		int num = data.length / 3;
		StringBuffer result = new StringBuffer();
		int p = 0;
		// int c=0;

		for (int i = 0; i < num; i++)
		{
			int b1 = (data[p] & 0xfc) >> 2;
			int b2 = (data[p] & 0x03) << 4 | (data[p + 1] & 0xf0) >> 4;
			int b3 = (data[p + 1] & 0x0f) << 2 | (data[p + 2] & 0xc0) >> 6;
			int b4 = data[p + 2] & 0x3f;

			result.append(b64encode(b1));
			result.append(b64encode(b2));
			result.append(b64encode(b3));
			result.append(b64encode(b4));

			p += 3;
			// c += 4;
		}

		switch (rem)
		{
			case 0:
				break;

			case 1:
			{
				int b1 = (data[p] & 0xfc) >> 2;
				int b2 = (data[p] & 0x03) << 4;

				result.append(b64encode(b1));
				result.append(b64encode(b2));
				result.append('=');
				result.append('=');
				break;
			}

			case 2:
			{
				int b1 = (data[p] & 0xfc) >> 2;
				int b2 = (data[p] & 0x03) << 4 | (data[p + 1] & 0xf0) >> 4;
				int b3 = (data[p + 1] & 0x0f) << 2;

				result.append(b64encode(b1));
				result.append(b64encode(b2));
				result.append(b64encode(b3));
				result.append('=');
				break;
			}
		}

		return result;
	}
907369
static InputSource createInputSource(Identifier id, Input input) {
    InputSource inputSource = createInputSource(input);
    if (id instanceof ExternalIdentifier)
      inputSource.setPublicId(((ExternalIdentifier)id).getPublicId());
    if (inputSource.getSystemId() == null)
      inputSource.setSystemId(getSystemId(id));
    return inputSource;
  }
976033
static public byte[] getEnglishBytes(String data) {
        if (null == data) {
            return null;
        }
        char[] chars = data.toCharArray();
        byte[] bytes = new byte[chars.length];
        for (int i = 0; i < chars.length; i++) {
            bytes[i] = (byte) chars[i];
        }
        return bytes;
    }
588971
public static String hexEncode(final byte[] data) {
        try {
            val result = Hex.encodeHex(data);
            return new String(result);
        } catch (final Exception e) {
            return null;
        }
    }
1330723
@Override
	public DataSource createDataSource(String source, Properties configurationProperties, String config) {
		DataSource ds = null;
		try {
			DirectDataSourceConfiguration cfg = new DirectDataSourceConfiguration(configurationProperties);
			ds = new DriverManagerDataSource(cfg.getDriverClassName(), cfg.getUrl(), cfg.getConnectionProperties()); 
		} catch (ClassNotFoundException e) {
			log.error("Driver class not found for '" + source + "' with configuration: " + configurationProperties, e);
		} catch (Exception e) {
			log.error("Error creating data source for '" + source + "' with configuration: " + configurationProperties, e);
		}
		return ds;
	}
1170932
public boolean buildData(String[] data) {
        final int length = data.length;

        for (int i = 0; i < length; i++) {
            addAddressToList(data[i]);
        }

        return true;
    }
338362
public static byte[] encodeBcd(String data, int num_bytes) {
        // allocate buffer
        byte buf[] = new byte[num_bytes];

        // if length of addr is odd, then add an F onto the end of it
        if ((data.length() % 2) != 0) {
            data += "F";
        }

        int index = 0;
        for (int i = 0; i < data.length(); i += 2) {
            StringBuilder x = new StringBuilder(data.substring(i, i + 2));
            x.reverse();
            buf[index] = ByteUtil.decodeHex(x.toString(), 2)[0];
            index++;
        }

        return buf;
    }
1009612
public CustomEmoji getKnownCustomEmojiOrCreateCustomEmoji(JsonNode data) {
        long id = Long.parseLong(data.get("id").asText());
        CustomEmoji emoji = customEmojis.get(id);
        return emoji == null ? new CustomEmojiImpl(this, data) : emoji;
    }
1361802
public InputStream resolveInput(String systemID) throws KNXMLException
	{
		try {
			try {
				final URL loc = new URL(systemID);
				return loc.openConnection().getInputStream();
			}
			catch (final MalformedURLException e) {
				return new FileInputStream(systemID);
			}
		}
		catch (final IOException e) {
			throw new KNXMLException("error opening " + systemID + ", " + e.getMessage());
		}
	}
201376
public byte[] sign(byte[] data, byte[] id) {
		lock.lock();
		final SM2Signer signer = getSigner();
		try {
			CipherParameters param = new ParametersWithRandom(getCipherParameters(KeyType.PrivateKey));
			if (id != null) {
				param = new ParametersWithID(param, id);
			}
			signer.init(true, param);
			signer.update(data, 0, data.length);
			return signer.generateSignature();
		} catch (Exception e) {
			throw new CryptoException(e);
		} finally {
			lock.unlock();
		}
	}
1352038
public static String toBinaryString(final byte[] data) {
        if (data == null) {
            return null;
        }
        final StringBuilder buf = new StringBuilder(data.length * 8);
        for (final byte element : data) {
            byte bits = element;
            for (int j = 0; j < 8; j++) {
                if ((bits & 0x80) == 0x80) {
                    buf.append('1');
                } else {
                    buf.append('0');
                }
                bits <<= 1;
            }
        }
        return buf.toString();
    }
568254
@Nonnull
	private static DataSource createDataSource(@Nonnull final MimePart part) {
		final DataHandler dataHandler = retrieveDataHandler(part);
		final DataSource dataSource = dataHandler.getDataSource();
		final String contentType = parseBaseMimeType(dataSource.getContentType());
		final byte[] content = readContent(retrieveInputStream(dataSource));
		final ByteArrayDataSource result = new ByteArrayDataSource(content, contentType);
		final String dataSourceName = parseDataSourceName(part, dataSource);

		result.setName(dataSourceName);
		return result;
	}
906329
public QrCodeEncoder addBytes(byte[] data) {
		StringBuilder builder = new StringBuilder(data.length);
		for (int i = 0; i < data.length; i++) {
			builder.append((char)data[i]);
		}

		MessageSegment segment = new MessageSegment();
		segment.message = builder.toString();
		segment.data = data;
		segment.length = data.length;
		segment.mode = QrCode.Mode.BYTE;

		segment.encodedSizeBits += 4;
		segment.encodedSizeBits += 8*segment.length;

		segments.add(segment);

		return this;
	}
134802
public ServerVoiceChannel getOrCreateServerVoiceChannel(JsonNode data) {
        long id = Long.parseLong(data.get("id").asText());
        ChannelType type = ChannelType.fromId(data.get("type").asInt());
        synchronized (this) {
            if (type == ChannelType.SERVER_VOICE_CHANNEL) {
                return getVoiceChannelById(id).orElseGet(() -> new ServerVoiceChannelImpl(api, this, data));
            }
        }
        // Invalid channel type
        return null;
    }