com.alibaba.rocketmq.common
类 UtilAll

java.lang.Object
  继承者 com.alibaba.rocketmq.common.UtilAll

public class UtilAll
extends Object

各种方法大杂烩

作者:
shijia.wxr

字段摘要
static String yyyy_MM_dd_HH_mm_ss
           
static String yyyy_MM_dd_HH_mm_ss_SSS
           
static String yyyyMMddHHmmss
           
 
构造方法摘要
UtilAll()
           
 
方法摘要
static int asInt(String str, int defaultValue)
           
static long asLong(String str, long defaultValue)
           
static String bytes2string(byte[] src)
          字节数组转化成16进制形式
static byte[] compress(byte[] src, int level)
           
static long computeEclipseTimeMilliseconds(long beginTime)
          计算耗时操作,单位ms
static long computNextHalfHourTimeMillis()
           
static long computNextHourTimeMillis()
           
static long computNextMinutesTimeMillis()
           
static long computNextMorningTimeMillis()
           
static int crc32(byte[] array)
           
static int crc32(byte[] array, int offset, int length)
           
static String currentStackTrace()
           
static String formatDate(Date date, String pattern)
           
static String frontStringAtLeast(String str, int size)
           
static double getDiskPartitionSpaceUsedPercent(String path)
          获取磁盘分区空间使用率
static int getPid()
           
static boolean isBlank(String str)
           
static boolean isItTimeToDo(String when)
           
static String jstack()
           
static String offset2FileName(long offset)
          将offset转化成字符串形式
左补零对齐至20位
static Date parseDate(String date, String pattern)
           
static String responseCode2String(int code)
           
static byte[] string2bytes(String hexString)
          16进制字符串转化成字节数组
static String timeMillisToHumanString()
           
static String timeMillisToHumanString(long t)
           
static String timeMillisToHumanString2(long t)
           
static String timeMillisToHumanString3(long t)
          返回日期时间格式,精度到秒
格式如下:2013122305190000
static byte[] uncompress(byte[] src)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

yyyy_MM_dd_HH_mm_ss

public static final String yyyy_MM_dd_HH_mm_ss
另请参见:
常量字段值

yyyy_MM_dd_HH_mm_ss_SSS

public static final String yyyy_MM_dd_HH_mm_ss_SSS
另请参见:
常量字段值

yyyyMMddHHmmss

public static final String yyyyMMddHHmmss
另请参见:
常量字段值
构造方法详细信息

UtilAll

public UtilAll()
方法详细信息

getPid

public static int getPid()

currentStackTrace

public static String currentStackTrace()

offset2FileName

public static String offset2FileName(long offset)
将offset转化成字符串形式
左补零对齐至20位


computeEclipseTimeMilliseconds

public static long computeEclipseTimeMilliseconds(long beginTime)
计算耗时操作,单位ms


isItTimeToDo

public static boolean isItTimeToDo(String when)

timeMillisToHumanString

public static String timeMillisToHumanString()

timeMillisToHumanString

public static String timeMillisToHumanString(long t)

computNextMorningTimeMillis

public static long computNextMorningTimeMillis()

computNextMinutesTimeMillis

public static long computNextMinutesTimeMillis()

computNextHourTimeMillis

public static long computNextHourTimeMillis()

computNextHalfHourTimeMillis

public static long computNextHalfHourTimeMillis()

timeMillisToHumanString2

public static String timeMillisToHumanString2(long t)

timeMillisToHumanString3

public static String timeMillisToHumanString3(long t)
返回日期时间格式,精度到秒
格式如下:2013122305190000

参数:
t -
返回:

getDiskPartitionSpaceUsedPercent

public static double getDiskPartitionSpaceUsedPercent(String path)
获取磁盘分区空间使用率


crc32

public static final int crc32(byte[] array)

crc32

public static final int crc32(byte[] array,
                              int offset,
                              int length)

bytes2string

public static String bytes2string(byte[] src)
字节数组转化成16进制形式


string2bytes

public static byte[] string2bytes(String hexString)
16进制字符串转化成字节数组


uncompress

public static byte[] uncompress(byte[] src)
                         throws IOException
抛出:
IOException

compress

public static byte[] compress(byte[] src,
                              int level)
                       throws IOException
抛出:
IOException

asInt

public static int asInt(String str,
                        int defaultValue)

asLong

public static long asLong(String str,
                          long defaultValue)

formatDate

public static String formatDate(Date date,
                                String pattern)

parseDate

public static Date parseDate(String date,
                             String pattern)

responseCode2String

public static String responseCode2String(int code)

frontStringAtLeast

public static String frontStringAtLeast(String str,
                                        int size)

isBlank

public static boolean isBlank(String str)

jstack

public static String jstack()


Copyright © 2012-2015. All Rights Reserved.