Fixed File Write (소스코드)
고정(Fixed)된 길이의 형태로 파일을 소스코드로 작성하여 Write할 경우 사용한다.
private FixedFileWriter<MSmpMultiFileWriteBtch02Dto> empInfoFixedWriter;
public void open(ExecutionContext executionContext) throws ItemStreamException {
……
String empInfoFixedFileName = "/data1/prod/bxm500/dat/fixed_file_" + oDate + ".txt";
empInfoFixedWriter= DefaultFileUtils.getFixedFileWriter(empInfoFixedFileName, MSmpMultiFileWriteBtch02Dto.class, "UTF-8");
empInfoFixedWriter.open(executionContext); // File Open
……
}
public void write(List<? extends MSmpMultiFileWriteBtch02Dto> in) throws Exception {
…
empInfoFixedWriter.write(mSmpMultiFileWriteBtch02Dtos); // Fixed File Write
}
……
public void update(ExecutionContext executionContext) throws ItemStreamException {
if(empInfoFixedWriter != null) empInfoFixedWriter.update(executionContext);
}
public void close() throws ItemStreamException {
if(empInfoFixedWriter != null) empInfoFixedWriter.close();
}