单页网站后台订单系统,网络营销的5种营销方式,网站建设合作流程图,南通seo公司网站我,谢谢您的关注.我想使用Java将大量数据,实际上是大量数据(600万行)导出到.csv文件.该应用程序是使用toplink(ojdbc14)的JPA摆动应用程序.我尝试使用#xff1a;但是BufferedWriterRandomAccessFile的FileChannel等等,但是尽管我将最大堆大小设置为800m(-Xmx800m),但是内存消…我,谢谢您的关注.我想使用Java将大量数据,实际上是大量数据(600万行)导出到.csv文件.该应用程序是使用toplink(ojdbc14)的JPA摆动应用程序.我尝试使用但是BufferedWriterRandomAccessFile的FileChannel等等,但是尽管我将最大堆大小设置为800m(-Xmx800m),但是内存消耗仍然很高,导致Java堆内存不足异常.我的源代码的最新版本...(more lines of code)FileChannel channel getRandomAccessFile(tempFile).getChannel();Object[][] data pag.getRawData(); //Database data in a multidimentional arrayfor (int j 0; j data.length; j) {write(data[j], channel); //write data[j] (an array) into the channelfreeStringLine(data[j]); //data[j] is an array, this method sets all positions nulldata[j] null;//sets reference in null}channel.force(false); //force writing in file system (HD)channel.close(); //Close the channelpag null;...(more lines of code)private void write(Object[] row, FileChannel channel) throws DatabaseException {if (byteBuff null) {byteBuff ByteBuffer.allocateDirect(1024 * 1024);}for (int j 0; j row.length; j) {if (j row.length - 1) {if (row[j] ! null) {byteBuff.put(row[j].toString().getBytes());}byteBuff.put(SPLITER_BYTES);} else {if (row[j] ! null) {byteBuff.put(row[j].toString().getBytes());}}}byteBuff.put(.toString().getBytes());byteBuff.flip();try {channel.write(byteBuff);} catch (IOException ex) {throw new DatabaseException(Imposible escribir en archivo temporal de exportación : ex.getMessage(), ex.getCause());}byteBuff.clear();}作为600万行,我不想在创建文件时将该数据存储在内存中.我制作了许多临时文件(每个文件有5000行),最后,使用两个FileChannel将所有这些临时文件附加到一个文件中.但是,缺少内存的异常是在加入之前启动的.您现在是否是导出大量数据的另一种策略非常感谢您的答复.对不起,我的英文,我正在提高xD