diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index c7c6bf2b34..d077a342e6 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -14,6 +14,7 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import com.fr.workspace.resource.WorkResourceTempRenameStream; import javax.swing.Icon; import java.io.ByteArrayInputStream; diff --git a/designer-base/src/main/java/com/fr/file/WorkResourceTempRenameStream.java b/designer-base/src/main/java/com/fr/file/WorkResourceTempRenameStream.java deleted file mode 100644 index 576239b354..0000000000 --- a/designer-base/src/main/java/com/fr/file/WorkResourceTempRenameStream.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fr.file; - -import com.fr.stable.ArrayUtils; -import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; -import com.fr.workspace.resource.WorkResource; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -/** - * 这个流会先输出临时文件到服务器. - * 然后再操作服务器对文件进行重命名. - * 用于设计器本地和远程修改模板. - */ -public class WorkResourceTempRenameStream extends ByteArrayOutputStream { - - private String path; - - public WorkResourceTempRenameStream(String path) { - this.path = path; - } - - @Override - public void close() throws IOException { - //写到给定的path上去 - byte[] content = super.toByteArray(); - if (ArrayUtils.isEmpty(content)) { - return; - } - - String tmpPath = path + ProjectConstants.TEMP_SUFFIX; - WorkResource resource = WorkContext.getWorkResource(); - // 输出临时文件到服务器 - resource.write(tmpPath, content); - // 重命名文件 - resource.rename(tmpPath, path); - } -}