相关疑难解决方法(0)

有没有一种聪明的方法来编写固定长度的平面文件?

是否有任何框架/库可以帮助在java中编写固定长度的平面文件?

我想把一个bean /实体的集合写成一个平面文件,而不用担心转换,填充,对齐,填充等等

例如,我想解析一个像:

public class Entity{
    String name = "name"; // length = 10; align left; fill with spaces
    Integer id = 123; // length = 5; align left; fill with spaces
    Integer serial = 321 // length = 5; align to right; fill with '0'
    Date register = new Date();// length = 8; convert to yyyyMMdd
}
Run Code Online (Sandbox Code Playgroud)

......进......

name      123  0032120110505
mikhas    5000 0122120110504
superuser 1    0000120101231
Run Code Online (Sandbox Code Playgroud)

...

java flat-file fixed-length-record fixed-length-file

11
推荐指数
2
解决办法
3万
查看次数