String XmlPath = "c:/metaTest.xml";
InputStream is = new FileInputStream(XmlPath);
byte[] data = getBytes(is);
long startTime = System.currentTimeMillis();
// byte[] result = process(serverIp, serverPort, url, data); before
byte[] result = process(serverIp, serverPort, url, toConvertForMetaData(data)); // by kyeong-an kwon


private static byte[] toConvertForMetaData(byte[] data) throws UnsupportedEncodingException {
// TODO Auto-generated method stub
String orgStr = new String(data, "EUC-KR");
String lowStr = null;
String preStr = null;
String postStr = null;
// Decimal -> decimal
orgStr = orgStr.replace("Decimal", "decimal");
String physicalName = "physicalName";
String resourceId = "resourceId";
String tmp = null;
int physicalNameIndex = orgStr.indexOf("physicalName");
int resourceGroupIndex = orgStr.indexOf("resourceGroup");
int resourceIdIndex = orgStr.indexOf("resourceId");
int revisionIndex = orgStr.indexOf("revision");
// physicalName : UPEER -> lower
preStr = orgStr.substring(0, physicalNameIndex+physicalName.length());
postStr = orgStr.substring(resourceGroupIndex, orgStr.length());
tmp = null;
tmp = orgStr.substring(physicalNameIndex+physicalName.length(), resourceGroupIndex).toLowerCase();
lowStr = preStr+tmp+postStr;
orgStr = lowStr;

// resourceId : UPEER -> lower
preStr = orgStr.substring(0, resourceIdIndex+resourceId.length());
postStr = orgStr.substring(revisionIndex, orgStr.length());
tmp = null;
tmp = orgStr.substring(resourceIdIndex+resourceId.length(), revisionIndex).toLowerCase();

lowStr = preStr+tmp+postStr;

return data = lowStr.getBytes();
}


난 바보인가?
참나. 오랜만에 코딩하면. 좀 심히 까먹는다 -_- 띠용!!

'Programming' 카테고리의 다른 글

SAX (Simple API For XML)  (0) 2008.09.29
jdbc  (0) 2008.09.25
LPAcampus 강좌  (0) 2008.09.22
개발자 코딩 스타일  (0) 2008.09.18
나도 개발자..  (0) 2008.09.18
페이스북 댓글
티스토리 댓글

+ Recent posts