Tabnine Logo
StringUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
StringUtils
in
com.kloudtek.util

Best Java code snippets using com.kloudtek.util.StringUtils (Showing top 20 results out of 315)

origin: com.kloudtek.idvkey.sdk/idvkey-sdk-java

/**
 * Constructor
 *
 * @param keyId     Key id
 * @param base64Key A {@link SignAndVerifyKey} key
 * @throws InvalidKeyException if the key was invalid
 */
public IDVKeyAPIClient(String keyId, KeyType keyType, String base64Key) throws InvalidKeyException {
  this(keyId, keyType, base64Decode(base64Key));
}
origin: com.kloudtek.ktutils/ktutils

public static boolean isNotBlank(String txt) {
  return !isBlank(txt);
}
origin: com.kloudtek.ktutils/ktutils-core

/**
 * Encodes a byte[] containing binary data, into a String containing characters in the Base-N alphabet.
 * Uses UTF8 encoding.
 *
 * @param pArray a byte array containing binary data
 * @return A String containing only Base-N character data
 */
public String encodeToString(final byte[] pArray) {
  return StringUtils.utf8(encode(pArray));
}
origin: com.kloudtek.ktutils/ktutils-core

public static String urlPathEncode( String path ) {
  StringBuilder buffer = new StringBuilder();
  for (char c : path.toCharArray()) {
    if (UNSAFE_URLPATH.indexOf(c) >= 0) {
      buffer.append('%');
      buffer.append(toHex(c / 16));
      buffer.append(toHex(c % 16));
    } else if( c < 32 && c > 128 ) {
      buffer.append(urlEncode(Character.toString(c)));
    } else {
      buffer.append(c);
    }
  }
  return buffer.toString();
}
origin: com.kloudtek.ktutils/ktutils

private static String resolveVarSub(String exp, Map<String, String> provisioningParams, boolean neverFail) throws IllegalArgumentException {
  if( containsVariableSubstitution(exp) ) {
    exp = substituteVariables(exp,provisioningParams,neverFail);
  Pattern pattern = getVarSubFuncPattern();
  Matcher m = pattern.matcher(exp);
  if (m.find()) {
    boolean suffixFunc = functionName.equals("s");
    if (prefixFunc || suffixFunc) {
      String[] args = splitTwoArgFunction(functionParams, neverFail);
      if (args != null) {
        String xfix = args[0];
        String val = resolveVarSub(args[1],provisioningParams, neverFail);
        if (StringUtils.isNotBlank(val)) {
          return suffixFunc ? xfix + val : val + xfix;
        } else {
        resolveVarSubFail(exp, neverFail);
      return resolveVarSub(functionParams,provisioningParams, neverFail).toUpperCase();
    } else if (functionName.equals("l")) {
      return resolveVarSub(functionParams,provisioningParams, neverFail).toLowerCase();
    } else if (functionName.equals("c")) {
      return capitalize(resolveVarSub(functionParams,provisioningParams, neverFail));
    } else if (functionName.equals("eb64")) {
      return base64Encode(utf8(resolveVarSub(functionParams,provisioningParams, neverFail)));
    } else if (functionName.equals("db64")) {
      return utf8(base64Decode(resolveVarSub(functionParams,provisioningParams, neverFail)));
    } else if (functionName.equals("t")) {
origin: com.kloudtek.ktutils/ktutils-core

public URLBuilder setRef(String ref) {
  this.ref = StringUtils.urlEncode(ref);
  return this;
}
origin: com.kloudtek.genesis/genesis-lib

String df = template.filter(defaultValue);
String dfOverride = template.getDefaultValue(id);
if (StringUtils.isNotBlank(dfOverride)) {
  df = dfOverride;
      if (response == null) {
        throw new TemplateExecutionException("Template processing cancelled by user");
      } else if (!blankAllowed && StringUtils.isBlank(response)) {
        val = null;
      } else {
origin: com.kloudtek.ktutils/ktutils-core

  public static boolean notEmpty(String... values) {
    for (String value : values) {
      if (StringUtils.isEmpty(value)) {
        return false;
      }
    }
    return true;
  }
}
origin: com.kloudtek.kryptotek/kryptotek-core

public static String saltedB64Digest(byte[] data, DigestAlgorithm alg) {
  return StringUtils.base64Encode(saltedDigest(data, alg));
}
origin: com.kloudtek.ktutils/ktutils-core

@Override
public String toString() {
  StringBuilder url = new StringBuilder();
  if (isNotEmpty(protocol)) {
    url.append(protocol).append("://");
  if (isNotEmpty(userInfo)) {
    url.append(StringUtils.urlEncode(userInfo)).append('@');
  if (isNotEmpty(host)) {
    url.append(host);
origin: com.kloudtek.genesis/genesis-lib

private InputStream getContent() throws TemplateExecutionException {
  try {
    if (StringUtils.isNotBlank(resource)) {
      if (!resource.startsWith("/")) {
        resource = "/" + resource;
      }
      resource = template.filter(resource);
      try (InputStream is = getClass().getResourceAsStream(resource)) {
        if (process == null || process) {
          content = IOUtils.toString(is, getEncoding());
        } else {
          return is;
        }
      }
    }
    if (content == null) {
      throw new TemplateExecutionException("Content missing from " + path);
    }
    if (trim == null || trim) {
      content = content.trim();
    }
    if (process == null || process) {
      return new ByteArrayInputStream(template.filter(content).getBytes(getEncoding()));
    } else {
      return new ByteArrayInputStream(content.getBytes(getEncoding()));
    }
  } catch (IOException e) {
    throw new TemplateExecutionException(e);
  }
}
origin: com.kloudtek.ktutils/ktutils-core

  /**
   * Convert a UUID in base 32 string format into a {@link UUID} object
   * @param base32Uuid uuid in base 32 format
   * @return UUID object
   */
  @NotNull
  public static UUID b32StrToUuid( @NotNull  String base32Uuid ) {
    return byteArrayToUuid(StringUtils.base32Decode(base32Uuid));
  }
}
origin: com.kloudtek.ktutils/ktutils-core

/**
 * Convert a UUID to a base 32 string (without padding)
 * @param uuid UUID
 * @return base32 string for the uuid
 */
@NotNull
public static String uuidToB32Str(@NotNull UUID uuid) {
  return StringUtils.base32Encode(uuidToByteArray(uuid)).replace("=","");
}
origin: com.kloudtek.ktutils/ktutils-core

public URLBuilder(String url) {
  if (url == null) {
    throw new IllegalArgumentException("url mustn't be null");
  }
  URI u = URI.create(url);
  protocol = u.getScheme();
  userInfo = u.getUserInfo();
  host = u.getHost();
  port = u.getPort();
  path = new StringBuilder();
  String uPath = u.getPath();
  if (uPath != null) {
    if (!uPath.startsWith("/")) {
      path.append('/');
    }
    this.path.append(uPath);
  }
  if (isNotEmpty(u.getQuery())) {
    parseQueryParams(u.getQuery());
  }
  ref = u.getFragment();
}
origin: com.kloudtek.ktutils/ktutils

public URLBuilder setUserInfo(String userInfo) {
  this.userInfo = StringUtils.urlEncode(userInfo);
  return this;
}
origin: com.kloudtek.ktutils/ktutils

  public static boolean notEmpty(String... values) {
    for (String value : values) {
      if (StringUtils.isEmpty(value)) {
        return false;
      }
    }
    return true;
  }
}
origin: com.kloudtek.kryptotek/kryptotek-core

public String toBase64Encoded() {
  return StringUtils.base64Encode(toByteArray());
}
origin: com.kloudtek.ktutils/ktutils

public static String urlPathEncode(String path) {
  StringBuilder buffer = new StringBuilder();
  for (char c : path.toCharArray()) {
    if (UNSAFE_URLPATH.indexOf(c) >= 0) {
      buffer.append('%');
      buffer.append(toHex(c / 16));
      buffer.append(toHex(c % 16));
    } else if (c < 32 && c > 128) {
      buffer.append(urlEncode(Character.toString(c)));
    } else {
      buffer.append(c);
    }
  }
  return buffer.toString();
}
origin: com.kloudtek.ktutils/ktutils

@Override
public String toString() {
  StringBuilder url = new StringBuilder();
  if (isNotEmpty(protocol)) {
    url.append(protocol).append("://");
  if (isNotEmpty(userInfo)) {
    url.append(StringUtils.urlEncode(userInfo)).append('@');
  if (isNotEmpty(host)) {
    url.append(host);
origin: com.kloudtek.genesis/genesis-maven

t.generate(target);
getLog().info("Finished generate template project");
if (StringUtils.isNotBlank(abort)) {
  throw new MojoExecutionException(abort);
com.kloudtek.utilStringUtils

Javadoc

Various string manipulation utility functions

Most used methods

  • base64Decode
  • isBlank
  • utf8
    Convert UTF-8 encoded byte arrays to a string
  • base64Encode
  • isEmpty
  • isNotBlank
  • urlEncode
    URL encode a string using UTF-8
  • base32Decode
  • base32Encode
  • isNotEmpty
  • substituteVariables
    Substitute variables in a string.
  • toHex
  • substituteVariables,
  • toHex,
  • urlPathEncode,
  • capitalize,
  • containsVariableSubstitution,
  • getVarSubFuncPattern,
  • nextChar,
  • resolveVarSub,
  • resolveVarSubFail,
  • splitTwoArgFunction

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now