public class FuncUtil extends Object
| Constructor and Description |
|---|
FuncUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
byteArrayToFile(byte[] bytes,
String filePath)
convert byte array to a file
|
static String |
convertMac(byte[] macs)
convert mac address from byte array to String
|
static String |
convertObjectToXml(Object obj,
Class cls)
Convert object to xml string.
|
static Object |
convertXmlToObject(String xml,
Class cls)
convert xml string to the given type
|
static byte[] |
fileToByte(String filePath)
convert file to byte array
|
static Marshaller |
getMarshaller(Class cls)
Return the JAXB Marshaller for configuratiion.
|
static Unmarshaller |
getUnmarshaller(Class cls)
Return the JAXB Unmarshaller for configuratiion.
|
static String |
readFile(BufferedReader br)
read from a bufferdReader ,get String between begin block to end block
|
static HashMap<String,String> |
readSecretFile(InputStream is)
read from a inputSteam ,get a map contains a license secret string and a sign string
|
static String |
readSecretFile(InputStream is,
String begin,
String end)
read from a inputStream ,get String between begin block to end block
|
static HashMap<String,String> |
readSecretFile(String filePath)
read from a file with absolute filePath ,get a map contains a license secret string and a sign string
|
static String |
readSecretFile(String filePath,
String begin,
String end)
read a file ,get String between begin block to end block
|
static String[] |
readSecretFileToArr()
read from a inputStream ,get String between begin block to end block
|
static void |
writeSecretFile(BufferedWriter bw,
String encStr,
String sign)
write a string to a file with bufferdWriter , only used in write host information to a file
|
static void |
writeSecretFile(String[] encStr) |
static void |
writeTempLicenseInfo(String enStr) |
public static String convertMac(byte[] macs)
macs - public static Object convertXmlToObject(String xml, Class cls)
xml - cls - public static Unmarshaller getUnmarshaller(Class cls) throws JAXBException
cls - JAXBExceptionpublic static String convertObjectToXml(Object obj, Class cls)
obj - (Object with JAXB annotations.)cls - public static Marshaller getMarshaller(Class cls) throws JAXBException
cls - JAXBExceptionpublic static byte[] fileToByte(String filePath) throws Exception
filePath - Exceptionpublic static void byteArrayToFile(byte[] bytes,
String filePath)
throws Exception
bytes - filePath - Exceptionpublic static void writeSecretFile(BufferedWriter bw, String encStr, String sign)
bw - encStr - sign - public static String readSecretFile(String filePath, String begin, String end)
filePath - begin - end - public static String readSecretFile(InputStream is, String begin, String end) throws Exception
is - begin - end - Exceptionpublic static HashMap<String,String> readSecretFile(String filePath)
filePath - public static HashMap<String,String> readSecretFile(InputStream is)
is - public static String readFile(BufferedReader br) throws IOException
br - IOExceptionpublic static void writeTempLicenseInfo(String enStr) throws IOException
IOExceptionpublic static void writeSecretFile(String[] encStr)
Copyright © 2014. All Rights Reserved.