[강운덕] [LUCYSUS-1744] 바인딩 변수 api 할당 api의 아규먼트를 문자열로 치환하는 로직 부분 개발.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@626 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2012-09-11 10:20:52 +00:00
parent 3b84111280
commit aea998cc03
14 changed files with 325 additions and 40 deletions
@@ -0,0 +1,53 @@
package com.profiler.util;
public class ArrayUtils {
public static String dropToString(byte[] bytes) {
return dropToString(bytes, 10);
}
public static String dropToString(byte[] bytes, int limit) {
if (bytes == null) {
return "null";
}
// TODO limit음수일 경우 예외처리 필요.
// size 4인 배열의 경 3에서 멈춰야 하므로 -1
int iMax = bytes.length - 1;
int iLimit = limit - 1;
if (iMax > iLimit) {
iMax = iLimit;
}
if (iMax == -1) {
if (bytes.length == 0) {
return "[]";
} else {
return "[...(" + bytes.length + ")]";
}
}
StringBuilder sb = new StringBuilder();
sb.append('[');
for (int i = 0; ; i++) {
sb.append(bytes[i]);
if (i == iMax) {
if (iMax < iLimit) {
return sb.append(']').toString();
} else {
if (i > 0) {
}
sb.append(", ");
sb.append("...(");
sb.append(bytes.length);
sb.append(")]");
return sb.toString();
}
}
sb.append(", ");
}
}
}