从文件中读取数组到内存
2011-12-19 20:54
190 查看
public void readDataFromFile(int[][] data, String fileName) { try { BufferedReader in = new BufferedReader(new FileReader(new File( fileName))); String line; int row = 0; while ((line = in.readLine()) != null) { String[] temp = line.split("\t"); for (int j = 0; j < temp.length; j++) { data[row][j] = Integer.parseInt(temp[j]); } row++; } in.close(); } catch (Exception e) { } }
相关文章推荐
- Android读取内存中的文件返回一个byte数组
- Android 读取内存文件返回byte数组
- 第三周项目五 数组做数据成员(文件读取+多文件)
- Python读取大文件的"坑“与内存占用检测
- matlab写数据到txt文件,C语言读取文件内容到数组@项目简介:基于PSS序列(频域)估计整数倍频偏
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- 内存映射文件中读取数据
- 动态可变字符数组的实现, 以及用于实现读取文件中的完整一行字符的功能
- 第四周(项目四扩展2)——数组做数据成员<读取文件>
- python读取二进制文件中的浮点数数组
- Silverlight读取文件加载到内存(StreamReader中文乱码问题)
- java读取文件读取工具类-将文件到byte数组的几种方式
- QT和VS读取.txt文件中的数据并保存为数组
- C++读取以空格作为数据区分标记,以回车为行标记的txt文件到一个整数数组(字符串妙用)
- PHP读取txt文件的内容并赋值给数组的代码
- 使用libpng,libjpeg从文件读取和从内存读取2中方式的实现
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- C++从txt文件中读取二维的数组方法
- 典型的Top K算法_找出一个数组里面前K个最大数...或找出1亿个浮点数中最大的10000个...一个文本文件,找出前10个经常出现的词,但这次文件比较长,说是上亿行或十亿行,总之无法一次读入内存
- Linux读取文件的哦内存