user: public
login

Cold Fusion ReadingA Large File Line By Line Using Java

If your text data file is larger than, say, 10 mb or so, ColdFusion does not have many efficient ways of dealing with this type of data.  This method puts the work on Java.

Not sure if this works.  Just storing it in case I need it for later.  Courtesy of Matt Robertson (cftalk mailing list member).

<cfset srcFile="c:/foo/bar/mongofile.txt"> <cfset fr=createObject("java","java.io.FileReader")> <cfset fr.init(srcFile)> <cfset br=createObject("java","java.io.BufferedReader")> <cfset br.init(fr)> <cfset imported.str=br.readLine()> <cfloop condition='isDefined("imported.str")'> <!--- ...do stuff... ---> <cfset imported.str = br.readLine()> </cfloop> <cfset br.close()>

size: 730 bytes    file modified: 2019.4.2