问题标签 [supercsv]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - SuperCSV,Dozer:写入 csv 文件。对于将列表分成多行的对象
我有一个 A 类,它的属性很少:
我正在尝试使用 supercsv 和 dozer 将其写入 csv 文件。
csv 的行数应与 A 类中的列表 bList 中的元素相同。并且应具有四列 col1、col2(这对于所有行都是通用的)和 b1、b2 来自 A 类中的 B 类列表.
目前在映射文件中我有:
但它只将数据映射到一行。在不将其映射到更扁平的类的情况下,有什么更好的方法来做到这一点。在映射中可以将它从 A 类映射到 CsvDozerBeanData 列表吗?那会奏效吗?
谢谢。
java - supercsv 与 jdk 1.7 的兼容性
我试图找出该库super-csv-2.1.0
是否与jdk 1.7
.
谁能给我一些建议?谢谢!!!
java - 使用 SuperCSV 更改标题值
根据这篇关于SuperCSV 能力的帖子,SuperCSV可以处理更改从数据库读取的标题(仅限列名)的值吗?
例如,以下代码片段详细说明了当前状态和预期状态。
当前状态
输入:
输出:具有列名的文件:
预期状态
输入:
OUTPUT:具有修改列名的文件:
非常感谢任何帮助。
java - SuperCSV 和推土机
我正在构建一个软件,其中输入是 csv 文件数据,它可以在单个文件中包含 90k 多行数据。
只是为了通知文件根本没有 HEADER 行,它将从数据本身开始。
通过谷歌搜索,我来到了超级 csv 和推土机映射器扩展。我无法找到一个示例,说明在读取单个 csv 行时可以用许多其他 pojo 的集合填充 Pojo。
我的客户 Pojo 看起来像下面的快照......
有些人可以提供指导,我也在阅读该网站,但它有一些简单的例子,因为日常软件有多种关联和自定义数据类型。
supercsv - JAR 中的 SuperCSV 缺少包
这听起来很傻,但我在为 SuperCSV 下载的任何 JAR 文件中都找不到包 org.supercsv.mock。
有谁知道这个包裹在哪里?
supercsv - MapEntry 的 CellProcessor
我有一个简单的 POJO,里面有一个 Map。
然后我的 csv 看起来像这样:
所以我创建了一个自定义单元处理器来解析这些:
然后我在我的产品中添加一个条目设置器方法:
不幸的是,这意味着我有 2 个 setter 方法:一个接受地图,另一个接受对我不起作用的条目(我无法控制 POJO 的生成方式)。有没有其他方法可以解析这样的 CSV 并且只有在我的产品中接受 Map 的设置器?
java - 在 CSV 文件中创建多个工作表
我正在使用 superCSV 在我的代码中以 csv 格式写入数据。它的工作非常好而且非常有效,但现在我的要求发生了变化。我需要在单个 xls 文件中编写多张工作表,这是非常耗时的任务。那么在 supercsv 中有什么方法可以让我在单个 csv 文件中写入多个工作表数据并将其发送给客户端,这样当客户端在 MS-Excel 中打开这个 csv 文件时,他可以看到多个工作表而不是我生成带有多张工作表的excel文件并将其发送给客户。
谢谢
java - SUPERCSV OutOfMemoryError:CsvListReader 中的 Java 堆空间
我知道在将 CsvListReader 限制为一行之前会问这个问题
我面临同样的问题,你能告诉我对标记器进行了哪些更改以克服这个问题......
在我的情况下,它每次都发生在不同的行号中,并不一致。有时它发生在 csv 的第 5000 行,而其他时候它发生在 6000,如果我进入调试模式并一一执行代码而不是它永远不会发生。你能帮我解决可能是什么问题吗?
请原谅我再次问同样的问题,但我似乎无法自己找到解决方案。
引发错误的 CSV 行之一是“???” 是日文
"CI","1","2014-04-01","BMW","","","","","","3","528","",0,0, "","","C","","","1","F","1","8","8",0,0,0,0,0,0,0, 0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0 ,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"", 0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0, 0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"","","0301 ","宝马","","7","","5","","5","","8","7","5","5","8", "","","","","","","","0","0","???","BMW","???","???","? ??","???","???","???","???","???","","","","",""," “,““,““,““,““,““,““,“???“,“宝马”,”???”,”???”,”???”,”? ??","???","???","???","???","","","","","","",""," ","","","","","","","",0,0,0,"0","0","0","2014-04-02"," 09:34:35","90002","082R"
另一个是这个
"CI","1","2014-04-01","BMW","","","","","","3","633","",0,0, "","","C","","","1","F","1","8","8",0,0,0,0,0,0,0, 0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0 ,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"", 0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0, 0,0,"",0,0,0,0,0,0,0,0,"",0,0,0,0,0,0,0,0,"","","0301 ","宝马","","7","","4","","5","","8","7","4","5","8", "","","","","","","","0","0","???","BMW","???","???","? ??","???","???","???","???","???","","","","",""," “,““,““,““,““,““,““,“???“,“宝马”,”???”,”???”,”???”,”? ??","???","???","???","???","","","","","","",""," ","","","","","","","",0,0,0,"0","0","0","2014-04-02"," 09:34:35","15762","082R"
该行似乎格式正确,但仍引发错误
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:99)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:575)
at java.lang.StringBuilder.append(StringBuilder.java:204)
at org.supercsv.io.Tokenizer.readColumns(Tokenizer.java:106)
at org.supercsv.io.AbstractCsvReader.readRow(AbstractCsvReader.java:179)
at org.supercsv.io.CsvListReader.read(CsvListReader.java:69)
java - JAVA中的CSV解析器,字符串中的双引号(SuperCSV,OpenCSV)
一整天我一直在寻找如何解决这个问题,什么都没有……我想编写函数,将 CSV 文件转换为列表(字符串)集合。这是这个函数:
但例如对于该输入:
toString(parse()) 的输出是:
而不是相同的输入:/ 我能做什么,字符串包含 \" (引号)?请帮助我。
java - Java:CSV 解析器 - 跳过引号
有什么方法可以在一些 CSV 解析器(例如 SuperCSV)的帮助下解析 CSV 文件(可变列数)以设置 List<String> 而不会在 Java 中跳过引号?对于输入:
解析后,我希望在集合中具有与输入相同的文本,而不是:
那个元素
"John" 将解析为字符串 "John" (而不是 John )
"" --> ""
,, --> ,null,
等等
我已经在这里写过这个,但我可能没有说得足够清楚。我想将 csv 文件解析为 List<String> 集,用它做一些事情并打印到标准输出,在它们所在的位置留下引号。请帮我。