public class Util extends Object
| 构造器和说明 |
|---|
Util() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Timestamp |
addTime(Timestamp start,
int year,
int month,
int day)
Adds the time.
|
static void |
attr(org.dom4j.Element e,
String name,
String v)
Attr.
|
static String |
checkTime(int id)
Check time.
|
static int |
compareDate(String d1,
String d2)
Compare date.
|
static void |
copyFile(String fileFromPath,
String fileToPath)
Copy file.
|
static String |
dateAdd(String interval,
int number,
Date date)
���������ָ��ʱ����������.
|
static int |
dateDiff(Date a,
Date b)
������������֮��ĵ�λ�����
.
|
static Timestamp |
dateToSQLTimestamp(Date date)
Date to SQL timestamp.
|
static String |
escape(String src)
Escape.
|
static String |
formatDate(Date date)
����һ��ʽ��������.
|
static String |
formatInteger(int i,
int j)
Format integer.
|
static String |
formatSDate(Date date)
����һ��ʽ��������.
|
static Timestamp |
getCurrentSQLTimestamp()
Gets the current SQL timestamp.
|
static int |
getDate(int curYear,
int curMonth,
int curDate)
Gets the date.
|
static String |
getDateString(long l,
String format)
Gets the date string.
|
static int |
getDiffYear(Timestamp start,
Timestamp end)
Gets the diff year.
|
static String |
getHeadIconPathById(int id)
Gets the head icon path by id.
|
static int |
getHour()
���ص�ǰ��Сʱ.
|
static String |
getLocalAddress()
Gets the local address.
|
static int |
getMinute()
���ص�ǰ�ķ���.
|
static Date |
getNow()
����һ����ǰ���ڣ�������ʽת��Ϊ�ַ�
��2004-4-30.
|
static String |
getNowDate()
����һ����ǰ���ڣ�������ʽת��Ϊ�ַ�
��2004-4-30.
|
static Date |
getNowDate2()
����һ����ǰ���ڣ�������ʽת��Ϊ�ַ�
��2004-4-30.
|
static String |
getNowDateTime()
����һ����ǰ���ں�ʱ�䣬������ʽת��Ϊ�ַ�
��2004-4-30 17:27:03.
|
static String |
getNowTime()
����һ����ǰ��ʱ�䣬������ʽת��Ϊ�ַ�
��17:27:03.
|
static int |
getSecond()
���ص�ǰ������.
|
static Date |
getStrDate(String strX)
�÷����ǽ��ַ���ת���������
.
|
static String |
getString(Object o)
Gets the string.
|
static int |
getThisMonth()
���ر���.
|
static int |
getThisYear()
���ص�ǰ��
.
|
static int |
getToDayOfMonth()
���ؽ����DZ��µĵڼ���.
|
static int |
getToWeekOfYear()
���ؽ����DZ���ĵڼ���.
|
static String |
int2path(int v)
Int 2 path.
|
static void |
main(String[] args)
The main method.
|
static String |
randomDigital(int length)
Random digital.
|
static int |
randomNumber(int max)
Random number.
|
static String |
randomString(int length)
Returns a random String of numbers and letters (lower and upper case) of
the specified length.
|
static StringBuilder |
readFromFile(File source)
Read from file.
|
static byte[] |
ReadFromFile(String fileName)
Read from file.
|
static String |
readTextFile(File source)
Read text file.
|
static String |
readTextFile(String fileName,
String encoding)
Read text file.
|
static String |
readUTF8TextFile(String fileName)
Read UTF 8 text file.
|
static void |
text(org.dom4j.Element e,
String v)
Text.
|
static Timestamp |
toSQLTimestamp(String time)
To SQL timestamp.
|
static Timestamp |
toSQLTimestamp2(String time)
To SQL timestamp 2.
|
static String |
unescape(String src)
Unescape.
|
static Timestamp |
valueoftime(String b)
Valueoftime.
|
static Timestamp |
valueoftime2(String b)
Valueoftime 2.
|
static void |
WriteStringToFile(String fn,
String dest)
Write string to file.
|
static String |
writeToFile(File source,
String dest)
Write to file.
|
static void |
WriteToFile(String filename,
byte[] content)
Write to file.
|
public static void WriteToFile(String filename, byte[] content)
filename - the filenamecontent - the contentpublic static String readUTF8TextFile(String fileName)
fileName - the file namepublic static String readTextFile(String fileName, String encoding)
fileName - the file nameencoding - the encodingpublic static byte[] ReadFromFile(String fileName)
fileName - the file namepublic static void text(org.dom4j.Element e,
String v)
e - the ev - the vpublic static final String int2path(int v)
v - the vpublic static void copyFile(String fileFromPath, String fileToPath) throws IOException
fileFromPath - the file from pathfileToPath - the file to pathIOException - Signals that an I/O exception has occurred.public static void attr(org.dom4j.Element e,
String name,
String v)
e - the ename - the namev - the vpublic static void WriteStringToFile(String fn, String dest)
fn - the fndest - the destpublic static String writeToFile(File source, String dest)
source - the sourcedest - the destpublic static String readTextFile(File source) throws IOException
source - the sourceIOException - Signals that an I/O exception has occurred.public static StringBuilder readFromFile(File source) throws IOException
source - the sourceIOException - Signals that an I/O exception has occurred.public static String getLocalAddress()
public static String getHeadIconPathById(int id)
id - the idpublic static int getDiffYear(Timestamp start, Timestamp end)
start - the startend - the endpublic static Timestamp addTime(Timestamp start, int year, int month, int day)
start - the startyear - the yearmonth - the monthday - the daypublic static final Timestamp getCurrentSQLTimestamp()
public static final Timestamp toSQLTimestamp(String time)
time - the timepublic static final Timestamp toSQLTimestamp2(String time)
time - the timepublic static Timestamp dateToSQLTimestamp(Date date)
date - the datepublic static String getNowTime()
����һ����ǰ��ʱ�䣬������ʽת��Ϊ�ַ�
��17:27:03.public static String getNowDate()
����һ����ǰ���ڣ�������ʽת��Ϊ�ַ�
��2004-4-30.public static Date getNow()
����һ����ǰ���ڣ�������ʽת��Ϊ�ַ�
��2004-4-30.public static Date getNowDate2()
����һ����ǰ���ڣ�������ʽת��Ϊ�ַ�
��2004-4-30.public static String getNowDateTime()
����һ����ǰ���ں�ʱ�䣬������ʽת��Ϊ�ַ�
��2004-4-30 17:27:03.public static int getThisYear()
���ص�ǰ��
.public static int getThisMonth()
public static int getToDayOfMonth()
public static int getHour()
public static int getMinute()
public static int getSecond()
public static int getToWeekOfYear()
public static String formatDate(Date date)
date - the datepublic static String formatSDate(Date date)
date - the datepublic static String dateAdd(String interval, int number, Date date)
interval - ��ʾҪ��ӵ�ʱ����("y":��;"d":��;"m":��;���б�Ҫ������������)number - ��ʾҪ��ӵ�ʱ�����ĸ���date - java.util.Date()public static int dateDiff(Date a, Date b)
������������֮��ĵ�λ�����
.a - java.util.Dateb - java.util.Datepublic static int getDate(int curYear,
int curMonth,
int curDate)
curYear - the cur yearcurMonth - the cur monthcurDate - the cur datepublic static String checkTime(int id)
id - the idpublic static Date getStrDate(String strX)
�÷����ǽ��ַ���ת���������
.strX - -�����ַ�����public static int compareDate(String d1, String d2)
d1 - the d 1d2 - the d 2public static String getDateString(long l, String format)
l - the lformat - the formatpublic static final String randomString(int length)
The specified length must be at least one. If not, the method will return null.
length - the desired length of the random String to return.public static final String randomDigital(int length)
length - the lengthpublic static final int randomNumber(int max)
max - the maxpublic static String formatInteger(int i, int j)
i - the ij - the jpublic static Timestamp valueoftime(String b)
b - the bpublic static Timestamp valueoftime2(String b)
b - the bpublic static void main(String[] args)
args - the argumentsCopyright © 2017. All rights reserved.