📄 toolsutil.java
字号:
/*
* Copyright 2003-2005 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jdon.jivejdon.dao.util;
import java.text.DateFormat;
import java.util.Date;
import com.jdon.jivejdon.Constants;
/**
* tools for this project.
* @author <a href="mailto:banqJdon<AT>jdon.com">banq</a>
*
*/
public class ToolsUtil {
private static final long ROOT_PARENTMESSAGEID = 0;
private static final char[] zeroArray = "0000000000000000".toCharArray();
public static final String zeroPadString(String string, int length) {
if (string == null || string.length() > length) {
return string;
}
StringBuffer buf = new StringBuffer(length);
buf.append(zeroArray, 0, length - string.length()).append(string);
return buf.toString();
}
public static final String dateToMillis(long now) {
return zeroPadString(Long.toString(now), 15);
}
public static String getDateTimeDisp(String datetime) {
if ((datetime == null) || (datetime.equals("")))
return "";
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
long datel = Long.parseLong(datetime);
return formatter.format(new Date(datel));
}
public static Long getParentIDOfRoot(){
return new Long(ROOT_PARENTMESSAGEID);
}
public static boolean isRoot(Long parentID){
if (parentID.longValue() == ROOT_PARENTMESSAGEID)
return true;
else
return false;
}
public static final String dateToMillis(Date date) {
return zeroPadString(Long.toString(date.getTime()), 15);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -