|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.riverock.dbrevision.utils.Utils
public class Utils
Common utils
Constructor Summary | |
---|---|
Utils()
|
Method Summary | ||
---|---|---|
static Object |
createCustomObject(String s)
|
|
static byte[] |
getBytesUTF(String s)
|
|
static Timestamp |
getCurrentTime()
Get current time as java.sql.Timestamp |
|
static Date |
getDateWithMask(String date,
String mask)
|
|
static
|
getObjectFromXml(Class<T> classType,
InputStream is)
|
|
static
|
getObjectFromXml(Class<T> classType,
InputStream is,
javax.xml.bind.ValidationEventHandler handler)
|
|
static
|
getObjectFromXml(Class<T> classType,
Source inSrc,
javax.xml.bind.ValidationEventHandler handler)
|
|
static
|
getObjectFromXml(Class<T> classType,
String str)
|
|
static int |
getStartUTF(byte[] b,
int maxByte)
|
|
static int |
getStartUTF(byte[] b,
int maxByte,
int offset)
|
|
static int |
getStartUTF(String s,
int maxByte)
|
|
static String |
getStringDate(Calendar c,
String mask)
convert given Calendar with mask to String. |
|
static String |
getStringDate(Calendar c,
String mask,
Locale loc)
convert given Calendar with mask and locale to String |
|
static String |
getStringDate(Date date,
String mask,
Locale loc,
TimeZone tz)
|
|
static String |
getTempDir()
|
|
static byte[] |
getXml(Object obj,
String rootElement)
|
|
static byte[] |
getXml(Object obj,
String rootElement,
String encoding)
|
|
static byte[] |
getXml(Object obj,
String rootElement,
String encoding,
boolean isIndent,
com.sun.xml.bind.marshaller.NamespacePrefixMapper[] namespacePrefixMappers)
|
|
static void |
putKey(Map<String,Object> map,
String key,
Object value)
Put value in map. |
|
static String |
replaceStringArray(String str_,
String[][] repl)
|
|
static void |
writeMarshalToOutputStream(Object obj,
String encoding,
String rootElement,
OutputStream fos,
boolean isIndent,
com.sun.xml.bind.marshaller.NamespacePrefixMapper[] namespacePrefixMappers)
|
|
static void |
writeObjectAsXml(Object obj,
OutputStream outputStream,
String encoding)
|
|
static void |
writeObjectAsXml(Object obj,
OutputStream outputStream,
String rootElement,
String encoding)
|
|
static void |
writeToFile(Object obj,
String fileName)
|
|
static void |
writeToFile(Object obj,
String fileName,
String encoding)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static void putKey(Map<String,Object> map, String key, Object value)
map
- mapkey
- keyvalue
- valuepublic static Timestamp getCurrentTime()
public static String getStringDate(Calendar c, String mask, Locale loc)
c
- calendarmask
- format maskloc
- locale
public static String getStringDate(Calendar c, String mask)
c
- calendarmask
- format mask
public static Date getDateWithMask(String date, String mask) throws ParseException
date
- mask
-
ParseException
public static String getStringDate(Date date, String mask, Locale loc, TimeZone tz)
date
- mask
- loc
- tz
-
public static byte[] getXml(Object obj, String rootElement) throws Exception
obj
- rootElement
-
Exception
public static byte[] getXml(Object obj, String rootElement, String encoding) throws javax.xml.bind.JAXBException
obj
- rootElement
- encoding
-
javax.xml.bind.JAXBException
public static byte[] getXml(Object obj, String rootElement, String encoding, boolean isIndent, com.sun.xml.bind.marshaller.NamespacePrefixMapper[] namespacePrefixMappers) throws javax.xml.bind.JAXBException
obj
- rootElement
- encoding
- isIndent
- namespacePrefixMappers
-
javax.xml.bind.JAXBException
public static void writeMarshalToOutputStream(Object obj, String encoding, String rootElement, OutputStream fos, boolean isIndent, com.sun.xml.bind.marshaller.NamespacePrefixMapper[] namespacePrefixMappers) throws javax.xml.bind.JAXBException
obj
- encoding
- rootElement
- fos
-
javax.xml.bind.JAXBException
public static void writeToFile(Object obj, String fileName) throws javax.xml.bind.JAXBException, FileNotFoundException
obj
- fileName
-
javax.xml.bind.JAXBException
FileNotFoundException
public static void writeToFile(Object obj, String fileName, String encoding) throws FileNotFoundException, javax.xml.bind.JAXBException
obj
- fileName
- encoding
-
FileNotFoundException
javax.xml.bind.JAXBException
public static void writeObjectAsXml(Object obj, OutputStream outputStream, String encoding) throws javax.xml.bind.JAXBException
obj
- outputStream
- encoding
-
javax.xml.bind.JAXBException
public static void writeObjectAsXml(Object obj, OutputStream outputStream, String rootElement, String encoding) throws javax.xml.bind.JAXBException
obj
- outputStream
- rootElement
- encoding
-
javax.xml.bind.JAXBException
public static <T> T getObjectFromXml(Class<T> classType, String str) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
public static <T> T getObjectFromXml(Class<T> classType, InputStream is) throws javax.xml.bind.JAXBException
classType
- is
-
javax.xml.bind.JAXBException
- on errorpublic static <T> T getObjectFromXml(Class<T> classType, InputStream is, javax.xml.bind.ValidationEventHandler handler) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
public static <T> T getObjectFromXml(Class<T> classType, Source inSrc, javax.xml.bind.ValidationEventHandler handler) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
public static Object createCustomObject(String s) throws ClassNotFoundException, InstantiationException, IllegalAccessException
s
-
ClassNotFoundException
InstantiationException
IllegalAccessException
public static String replaceStringArray(String str_, String[][] repl)
str_
- source stringrepl
- array of values for search and replace
public static byte[] getBytesUTF(String s)
s
-
public static int getStartUTF(String s, int maxByte)
s
- maxByte
-
public static int getStartUTF(byte[] b, int maxByte)
b
- maxByte
-
public static int getStartUTF(byte[] b, int maxByte, int offset)
b
- maxByte
- offset
-
public static String getTempDir()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |