gpt4 book ai didi

java - Apache Camel 创建两个具有相同名称但扩展名不同的单独文件

转载 作者:行者123 更新时间:2023-12-02 10:39:19 30 4
gpt4 key购买 nike

我想在代码下面创建两个具有相同名称但扩展名不同的文件,我可以在其中创建文件 abc.dat 同时我想创建另一个文件 ex abc.txtabc.dat 相同的位置将为空:

from("file:C:\\input?filter=#testFilter").split(body().tokenize("\n")).
streaming().setHeader(Exchange.FILE_NAME,simple(newFileName+".dat")).bean(LineParser.class, "process").to("file:C:\\output"+ Constants.getMapping().get(argumentName)+"?fileExist=Append");

提前致谢。

最佳答案

要在同一目录中创建第二个空文件,请在 camel file language 的帮助下使用 donefileName 选项(需要toD)。

from("file:C:\\input?filter=#testFilter")
.split(body().tokenize("\n"))
.streaming()
.setHeader(Exchange.FILE_NAME,simple(newFileName+".dat"))
.bean(LineParser.class, "process")
.toD("file:C:\\output"+ Constants.getMapping().get(argumentName)+"?fileExist=Append&donefileName=${file:name.noext}.txt")

附: ${file:name.noext} 表示数据文件名中的 abc 部分 abc.txt

关于java - Apache Camel 创建两个具有相同名称但扩展名不同的单独文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53046998/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com