public class KittyUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CODE_COPIED_SUCCESSFULLY |
static int |
CODE_UNABLE_TO_COPY |
static int |
CODE_UNABLE_TO_COPY_ALREADY_EXISTS |
static java.lang.String |
T_TO_A_EXCEPTION_STRING_PATTERN |
Constructor and Description |
---|
KittyUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyDirectoryFromAssetsToFS(android.content.Context ctx,
java.lang.String assetsPath,
java.io.File baseFile) |
static void |
copyFileFromAssets(android.content.Context ctx,
java.lang.String assetsPath,
java.io.File baseFile) |
static void |
createDirectoryInternalMemory(android.content.Context ctx,
java.lang.String dirname)
Creates directory in internal memory.
|
static boolean |
endsWithIgnoreCase(java.lang.String str,
java.lang.String suffix) |
static java.lang.String |
fieldNameToLowerCaseUnderScore(java.lang.String fieldName)
Converts input string (designed for camel case variable names)
into lower case underscored string
|
static java.lang.String |
getStringPartBeforeFirstOccurrenceOfChar(java.lang.String input,
char Char,
boolean reverse)
Returns part of parameter string before first occurrence of parameter char.
|
static java.lang.String |
implode(java.lang.String[] toImlpode,
char separatorChar) |
static java.lang.String |
implode(java.lang.String[] toImplode,
java.lang.String separator)
Implodes provided array's value in string with provided separator.
|
static java.lang.String |
implodeWithCommaInBKT(java.lang.String[] toImplode)
Implodes elements of provided array into string with comma + space separator and surrounded
with bkt's. |
static java.util.LinkedList<java.lang.String> |
readFileFromAssetsToLinkedList(android.content.Context ctx,
java.lang.String relativeFilePath)
Reads data from provided assets path returns it content as a LinkedList filled with Strings
|
static java.lang.String |
readFileFromAssetsToString(android.content.Context ctx,
java.lang.String relativeFilePath)
Reads data from provided assets path returns it content as a string
|
static java.util.LinkedList<java.lang.String> |
readFileToLinkedList(java.io.File file)
Reads provided file into LinkedList filled with Strings, one line per String
|
static java.lang.String |
readFileToString(java.io.File file)
Reads provided file into String
|
static java.lang.String |
removeAllIllegalCharactersFromPathString(java.lang.String input)
Replaces all symbols except those that can be used in paths
|
static java.lang.String |
statementPrettyPrinting(java.lang.String generatedStatement)
Simple method to remove duplicate spaces from statements
|
static TypeAffinities |
typeToAffinity(java.lang.reflect.Type fType)
Returns type affinity depends on java field type
|
static void |
writeStringsToFile(java.io.File filepath,
java.util.List<java.lang.String> data,
boolean append,
boolean createIfNotExists) |
static void |
writeStringToFile(java.io.File filepath,
java.lang.String data,
boolean append,
boolean createIfNotExists)
Writes string to specified path.
|
public static final java.lang.String T_TO_A_EXCEPTION_STRING_PATTERN
public static final int CODE_UNABLE_TO_COPY_ALREADY_EXISTS
public static final int CODE_UNABLE_TO_COPY
public static final int CODE_COPIED_SUCCESSFULLY
public static java.lang.String implode(java.lang.String[] toImplode, java.lang.String separator)
toImplode
- separator
- public static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String suffix)
public static java.lang.String implode(java.lang.String[] toImlpode, char separatorChar)
public static java.lang.String implodeWithCommaInBKT(java.lang.String[] toImplode)
toImplode
- public static final java.lang.String statementPrettyPrinting(java.lang.String generatedStatement)
generatedStatement
- public static java.lang.String fieldNameToLowerCaseUnderScore(java.lang.String fieldName)
fieldName
- public static final TypeAffinities typeToAffinity(java.lang.reflect.Type fType)
fType
- public static final java.lang.String readFileToString(java.io.File file) throws java.io.IOException
file
- file to readjava.io.IOException
- as usualjava.lang.IllegalArgumentException
- when file is directory or has no read accesspublic static final java.util.LinkedList<java.lang.String> readFileToLinkedList(java.io.File file) throws java.io.IOException
file
- java.io.IOException
public static final java.util.LinkedList<java.lang.String> readFileFromAssetsToLinkedList(android.content.Context ctx, java.lang.String relativeFilePath) throws java.io.IOException
ctx
- relativeFilePath
- java.io.IOException
public static final java.lang.String readFileFromAssetsToString(android.content.Context ctx, java.lang.String relativeFilePath) throws java.io.IOException
ctx
- relativeFilePath
- java.io.IOException
public static final java.lang.String getStringPartBeforeFirstOccurrenceOfChar(java.lang.String input, char Char, boolean reverse)
input
- Char
- reverse
- public static final void createDirectoryInternalMemory(android.content.Context ctx, java.lang.String dirname)
ctx
- dirname
- public static final void writeStringToFile(java.io.File filepath, java.lang.String data, boolean append, boolean createIfNotExists) throws java.io.IOException
filepath
- - where to write file.data
- - what to write to file.append
- - append existing data if true, otherwisecreateIfNotExists
- - create file if not existsjava.io.IOException
public static final void copyDirectoryFromAssetsToFS(android.content.Context ctx, java.lang.String assetsPath, java.io.File baseFile)
public static final void copyFileFromAssets(android.content.Context ctx, java.lang.String assetsPath, java.io.File baseFile) throws java.io.IOException
java.io.IOException
public static final void writeStringsToFile(java.io.File filepath, java.util.List<java.lang.String> data, boolean append, boolean createIfNotExists) throws java.io.IOException
java.io.IOException
public static final java.lang.String removeAllIllegalCharactersFromPathString(java.lang.String input)
input
- string to replace illegal symbols