feat: 增加61850下载文件功能
parent
5ecb8193ee
commit
bd05b58dc4
@ -0,0 +1,29 @@
|
||||
package com.xydl.cac.iec;
|
||||
|
||||
import com.beanit.iec61850bean.GetFileListener;
|
||||
import lombok.Synchronized;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Slf4j
|
||||
public class GetFileAction implements GetFileListener {
|
||||
File file;
|
||||
|
||||
public GetFileAction(String filename) {
|
||||
file = new File(filename);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Synchronized
|
||||
public boolean dataReceived(byte[] fileData, boolean moreFollows) {
|
||||
try {
|
||||
FileUtils.writeByteArrayToFile(file, fileData, true);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("61850获取文件异常.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue