-1
txt 파일을 읽고 1 ~ 3 줄을 전송합니다. Mesaage 및 3 ~ 6 줄 읽기 메시지를 보내십시오. 을 보내지 만 1 ~ 3 번 읽은 후 다시 읽으십시오. 다음에 다시 1 ~ 3 줄을 보내십시오. 나는 3 라인 txt 파일에서 반복 읽기 원하는3 줄 txt 파일에서 읽음
있는 test.txt
1|11221234|c1|c2|c3|c4 2|11221234|c1|c2|c3|c4 3|11221234|c1|c2|c3|c4 4|11221234|c1|c2|c3|c4 5|11221234|c1|c2|c3|c4 6|11221234|c1|c2|c3|c4 7|11221234|c1|c2|c3|c4 8|11221234|c1|c2|c3|c4 9|11221234|c1|c2|c3|c4 9|11221234|c1|c2|c3|c4 10|11221234|c1|c2|c3|c4 11|11221234|c1|c2|c3|c4 12|11221234|c1|c2|c3|c4 13|11221234|c1|c2|c3|c4
while ((s = in.readLine()) != null) {
cnt++;
Element record = new Element("RECORD");
String[] arr = s.split("│");
if (arr.length == tableInfoMap.size()) {
for (int i = 0; i < arr.length; i++) {
int j = i + 1;
String fieldName = (String) tableInfoMap
.get("COLUMN" + j);
Element field = new Element(fieldName);
field.addContent(new CDATA(arr[i]));
record.addContent(field);
}
} else {
throw new ArrayIndexOutOfBoundsException(" ");
}
rootElement.addContent(record);
if (cnt >= 3) {
sendMsg(srcTblName, tgtTblName, classPath,
className, doc, comm, sndAgency, rcvAgency,
cnt);
cnt = 0;
}
}
if (cnt > 0) {
boolean isSend = sendMsg(srcTblName, tgtTblName,
classPath, className, doc, comm, sndAgency,
rcvAgency, cnt);
in.close();
if (isSend == true) {
File f = new File(file);
if (f.delete() == true) {
logger.info("Send File Success: " + file);
logger.debug(f.getPath());
} else {
logger.warn("Send File Fail: " + file);
logger.debug(f.getPath());
}
}
}
코드를 포맷하십시오. 또한 문제와 같은 특정 정보를 추가해야합니다. 어떤 오류가 발생합니까? – ohlmar