简体   繁体   English

Spring Item Writer产生的文件的第一行前缀带有不可打印的字符

[英]Spring Item Writer producing file with first line prefix with non-printable characters

I recently discovered that file produced by flat file item writer is prefixed with non printable characters. 我最近发现,平面文件项目编写器生成的文件带有不可打印字符的前缀。 I have attached screenshot below. 我已经附上了下面的截图。 Project uses Spring 4.1.7 RELEASE jar with Spring batch version 2.2.5 RELEASE on java 8 platform. 项目在Java 8平台上使用Spring 4.1.7 RELEASE jar和Spring批处理版本2.2.5 RELEASE。 Any idea to resolve this? 有解决的办法吗?

See screenshot 看截图

[Update 03/20] This issue is resolved. [更新03/20]此问题已解决。 Output file extension chosen was .out and for some reason when this file was created on Windows platform it had non-printable characters in the beginning of the line. 选择的输出文件扩展名为.out,由于某种原因,在Windows平台上创建此文件时,该行的开头具有不可打印的字符。 When extension was changed to .txt, output was as expected. 当扩展名更改为.txt时,输出符合预期。 On Linux, output file with .out extension has no issues. 在Linux上,扩展名为.out的输出文件没有问题。 To conclude, it was OS platform specific issue, but if someone knows actual reason behind this then please shed some light. 总而言之,这是OS平台特定的问题,但是如果有人知道其背后的实际原因,请说明一下。

没有任何代码可看,我猜您正在写一行(可能是字符串),该行在Java中只包含NULL值,因此在文件中得到NULNULNULNUL...。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM