将CSV文件导入Java [英] Importing a CSV File into Java

查看:381
本文介绍了将CSV文件导入Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我写的程序中,我想要导入CSV文件。此时,它需要一个基本的文本文件。

In the program I am writing, I want to be able to import CSV files. At the moment, it takes a basic text file in.

File mainemails = new File ("mainemails.txt");

我知道对于CSV导入使用File可能不是最节省时间的东西使用。什么是导入CSV文件的最有效的方法?

I know that for CSV imports using File is probably not the most time-efficient thing to use. What would be the most efficient way to import a CSV file? Would I have to download any new libraries to use an efficient method?

推荐答案

您可以使用 opencsv 导入csv数据,然后从中构建对象。

You can use opencsv for importing csv data and then constructing objects from it.

我更喜欢使用库这样我可以节省开发时间。此外,他们倾向于更好地解决具体问题。

I prefer using libraries so that I can save development time. Also they tend to solve specific problems better.

这篇关于将CSV文件导入Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆