Java Code Examples for org.eclipse.jgit.lib.Constants#encode()

The following examples show how to use org.eclipse.jgit.lib.Constants#encode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExactPathFilter.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private ExactPathFilter (final PathFilter filter) {
    pathStr = filter.getPath();
    pathRaw = Constants.encode(pathStr);
    this.filter = filter;
}
 
Example 2
Source File: PatternMatchRevFilter.java    From onedev with MIT License 3 votes vote down vote up
/**
 * Encode a string pattern for faster matching on byte arrays.
 * <p>
 * Force the characters to our funny UTF-8 only convention that we use on
 * raw buffers. This avoids needing to perform character set decodes on the
 * individual commit buffers.
 *
 * @param patternText
 *            original pattern string supplied by the user or the
 *            application.
 * @return same pattern, but re-encoded to match our funny raw UTF-8
 *         character sequence {@link org.eclipse.jgit.util.RawCharSequence}.
 */
protected static final String forceToRaw(String patternText) {
	final byte[] b = Constants.encode(patternText);
	final StringBuilder needle = new StringBuilder(b.length);
	for (byte element : b)
		needle.append((char) (element & 0xff));
	return needle.toString();
}
 
Example 3
Source File: FooterKey.java    From onedev with MIT License 2 votes vote down vote up
/**
 * Create a key for a specific footer line.
 *
 * @param keyName
 *            name of the footer line.
 */
public FooterKey(String keyName) {
	name = keyName;
	raw = Constants.encode(keyName.toLowerCase(Locale.ROOT));
}