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

How to use
utf8
method
in
com.kloudtek.util.StringUtils

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

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

/**
 * Tests a given String to see if it contains only valid characters within the Base64 alphabet. Currently the
 * method treats whitespace as valid.
 *
 * @param base64 String to test
 * @return {@code true} if all characters in the String are valid characters in the Base64 alphabet or if
 * the String is empty; {@code false}, otherwise
 * @since 1.5
 */
public static boolean isBase64(final String base64) {
  return isBase64(StringUtils.utf8(base64));
}
origin: com.kloudtek.ktutils/ktutils-core

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

/**
 * Tests a given String to see if it contains only valid characters within the alphabet.
 * The method treats whitespace and PAD as valid.
 *
 * @param basen String to test
 * @return {@code true} if all characters in the String are valid characters in the alphabet or if
 * the String is empty; {@code false}, otherwise
 * @see #isInAlphabet(byte[], boolean)
 */
public boolean isInAlphabet(final String basen) {
  return isInAlphabet(StringUtils.utf8(basen), true);
}
origin: com.kloudtek.ktutils/ktutils-core

/**
 * Encodes binary data using the base64 algorithm but does not chunk the output.
 * NOTE:  We changed the behaviour of this method from multi-line chunking (commons-codec-1.4) to
 * single-line non-chunking (commons-codec-1.5).
 *
 * @param binaryData binary data to encode
 * @return String containing Base64 characters.
 * @since 1.4 (NOTE:  1.4 chunked the output, whereas 1.5 does not).
 */
public static String encodeBase64String(final byte[] binaryData) {
  return StringUtils.utf8(encodeBase64(binaryData, false));
}
origin: com.kloudtek.ktutils/ktutils-core

/**
 * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The
 * url-safe variation emits - and _ instead of + and / characters.
 * <b>Note: no padding is added.</b>
 *
 * @param binaryData binary data to encode
 * @return String containing Base64 characters
 * @since 1.4
 */
public static String encodeBase64URLSafeString(final byte[] binaryData) {
  return StringUtils.utf8(encodeBase64(binaryData, false, true));
}
origin: com.kloudtek.ktutils/ktutils-core

/**
 * Decodes a String containing characters in the Base-N alphabet.
 *
 * @param pArray A String containing Base-N character data
 * @return a byte array containing binary data
 */
public byte[] decode(final String pArray) {
  return decode(StringUtils.utf8(pArray));
}
origin: com.kloudtek.ktutils/ktutils-core

/**
 * Tests a given String to see if it contains only valid characters within the Base64 alphabet. Currently the
 * method treats whitespace as valid.
 *
 * @param base64 String to test
 * @return {@code true} if all characters in the String are valid characters in the Base64 alphabet or if
 * the String is empty; {@code false}, otherwise
 * @since 1.5
 */
public static boolean isBase64(final String base64) {
  return isBase64(StringUtils.utf8(base64));
}
origin: com.kloudtek.ktutils/ktutils

/**
 * Decodes a String containing characters in the Base-N alphabet.
 *
 * @param pArray A String containing Base-N character data
 * @return a byte array containing binary data
 */
public byte[] decode(final String pArray) {
  return decode(StringUtils.utf8(pArray));
}
origin: com.kloudtek.kryptotek/kryptotek-core

public static byte[] saltedDigest(String text, DigestAlgorithm alg) {
  return saltedDigest(StringUtils.utf8(text), alg);
}
origin: com.kloudtek.ktserializer/ktserializer-runtime

public String getString(long id) throws InvalidSerializedDataException {
  return StringUtils.utf8(getData(id));
}
origin: com.kloudtek.ktserializer/ktserializer-runtime

  public long setString(String data) {
    return setData(StringUtils.utf8(data));
  }
}
origin: com.kloudtek.ktutils/ktutils

/**
 * 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

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

/**
 * Tests a given String to see if it contains only valid characters within the alphabet.
 * The method treats whitespace and PAD as valid.
 *
 * @param basen String to test
 * @return {@code true} if all characters in the String are valid characters in the alphabet or if
 * the String is empty; {@code false}, otherwise
 * @see #isInAlphabet(byte[], boolean)
 */
public boolean isInAlphabet(final String basen) {
  return isInAlphabet(StringUtils.utf8(basen), true);
}
origin: com.kloudtek.ktutils/ktutils

/**
 * Encodes binary data using the base64 algorithm but does not chunk the output.
 * NOTE:  We changed the behaviour of this method from multi-line chunking (commons-codec-1.4) to
 * single-line non-chunking (commons-codec-1.5).
 *
 * @param binaryData binary data to encode
 * @return String containing Base64 characters.
 * @since 1.4 (NOTE:  1.4 chunked the output, whereas 1.5 does not).
 */
public static String encodeBase64String(final byte[] binaryData) {
  return StringUtils.utf8(encodeBase64(binaryData, false));
}
origin: com.kloudtek.ktutils/ktutils

/**
 * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The
 * url-safe variation emits - and _ instead of + and / characters.
 * <b>Note: no padding is added.</b>
 *
 * @param binaryData binary data to encode
 * @return String containing Base64 characters
 * @since 1.4
 */
public static String encodeBase64URLSafeString(final byte[] binaryData) {
  return StringUtils.utf8(encodeBase64(binaryData, false, true));
}
origin: com.kloudtek.idvkey.sdk/idvkey-sdk-java

private String exec(HttpUriRequest req) throws IOException {
  final CloseableHttpResponse response = httpClient.execute(req);
  try {
    checkStatus(response);
    if (response.getEntity() != null) {
      return StringUtils.utf8(IOUtils.toByteArray(response.getEntity().getContent()));
    } else {
      return null;
    }
  } finally {
    response.close();
  }
}
origin: com.kloudtek.idvkey.sdk/idvkey-sdk-java

/**
 * Check if a user has been linked against your website.
 * Use this to verify the user has been successfully linked to your website/service after he's been redirected to
 * the redirectUrl you specified in {@link #linkUser(String, URL, String, URL)}.
 *
 * @param serviceId Website serviceId
 * @param userRef   User reference (generally the user's username on your website)
 * @return true if the user is linked against your website
 * @throws IOException If error occurred performing the operation
 */
public boolean isUserLinked(String serviceId, String userRef) throws IOException {
  final HttpGet req = new HttpGet(linkUserUrl(serviceId, userRef));
  try {
    final CloseableHttpResponse response = httpClient.execute(req);
    final int statusCode = response.getStatusLine().getStatusCode();
    if (statusCode == 404) {
      return false;
    } else if (statusCode == 200) {
      return Boolean.parseBoolean(StringUtils.utf8(IOUtils.toByteArray(response.getEntity().getContent())));
    } else {
      throw new IOException("Server returned " + response.getStatusLine());
    }
  } finally {
    req.releaseConnection();
  }
}
origin: com.kloudtek.idvkey.sdk/idvkey-sdk-java

/**
 * Link an IDVKey user to your service/website.
 * You need to call this operation before a user on your website can use his IDVKey device
 *
 * @param serviceId   Your website serviceId
 * @param redirectUrl The URL to which the user's browser will be redirected to after he's approved the link
 * @param userRef     User reference (generally the user's username on your website)
 * @param cancelUrl   URL to redirect user to should he wish to cancel the linking
 * @return URL you should redirect your user's browser to, in order for him to approve the linking
 * @throws IOException If the server returned an error
 * @throws UserAlreadyLinkedException if the user was already linked
 */
public URL linkUser(String serviceId, URL redirectUrl, String userRef, URL cancelUrl) throws IOException, UserAlreadyLinkedException {
  final HttpPost req = new HttpPost(linkUserUrl(serviceId, userRef, redirectUrl, cancelUrl));
  try {
    final CloseableHttpResponse response = httpClient.execute(req);
    final int retCode = response.getStatusLine().getStatusCode();
    if (retCode == 409) {
      throw new UserAlreadyLinkedException();
    } else if (retCode < 200 || retCode > 299) {
      throw new IOException("Server returned " + response.getStatusLine());
    }
    return new URL(StringUtils.utf8(IOUtils.toByteArray(response.getEntity().getContent())));
  } finally {
    req.releaseConnection();
  }
}
com.kloudtek.utilStringUtilsutf8

Javadoc

Convert string to an UTF-8 encoded byte array

Popular methods of StringUtils

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

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • setContentView (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Top Sublime Text plugins
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