com.hazelcast.util
Class StringUtil

java.lang.Object
  extended by com.hazelcast.util.StringUtil

public final class StringUtil
extends Object

Utility class for Strings.


Method Summary
static String bytesToString(byte[] bytes)
          Creates a UTF8_CHARSET string from a byte array.
static String bytesToString(byte[] bytes, int offset, int length)
          Creates a UTF8_CHARSET string from a byte array.
static String getLineSeperator()
          Returns system property "line.seperator"
static boolean isNullOrEmpty(String s)
          Checks if a string is empty or not.
static String lowerCaseInternal(String s)
          HC specific settings, operands etc.
static byte[] stringToBytes(String s)
          Creates a byte array from a string.
static String upperCaseInternal(String s)
          HC specific settings, operands etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

bytesToString

public static String bytesToString(byte[] bytes,
                                   int offset,
                                   int length)
Creates a UTF8_CHARSET string from a byte array.

Parameters:
bytes - the byte array.
offset - the index of the first byte to decode
length - the number of bytes to decode
Returns:
the string created from the byte array.

bytesToString

public static String bytesToString(byte[] bytes)
Creates a UTF8_CHARSET string from a byte array.

Parameters:
bytes - the byte array.
Returns:
the string created from the byte array.

stringToBytes

public static byte[] stringToBytes(String s)
Creates a byte array from a string.

Parameters:
s - the string.
Returns:
the byte array created from the string.

isNullOrEmpty

public static boolean isNullOrEmpty(String s)
Checks if a string is empty or not.

Parameters:
s - the string to check.
Returns:
true if the string is null or empty, false otherwise

upperCaseInternal

public static String upperCaseInternal(String s)
HC specific settings, operands etc. use this method. Creates an uppercase string from the given string.

Parameters:
s - the given string
Returns:
an uppercase string, or null/empty if the string is null/empty

lowerCaseInternal

public static String lowerCaseInternal(String s)
HC specific settings, operands etc. use this method. Creates a lowercase string from the given string.

Parameters:
s - the given string
Returns:
a lowercase string, or null/empty if the string is null/empty

getLineSeperator

public static String getLineSeperator()
Returns system property "line.seperator"

Returns:
line seperator for the specific OS


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.