简体   繁体   English

java使用FreeMarker模板写入文本文件

[英]java writing to a text file using FreeMarker Templates

Need to write data to a text file using Free Marker API, but when the line encounters 255 characters, the remaining characters should be printed to the next line . 需要使用Free Marker API将数据写入文本文件,但是当该行遇到255个字符时,其余字符应打印到下一行。

Is this supported by Free Marker? Free Marker支持吗?

Since you can pass whatever java.io.Writer to Template.process (or to Environment.process ), you can pass one that writes to a file and inserts a CR when the line has reached 255 character. 因为您可以将任何java.io.Writer传递给Template.process (或Environment.process ),所以您可以传递一个写到文件并在行数达到255个字符时插入CR的代码。 You will have to implement that Writer of course. 当然,您将必须实现该Writer

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

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