Created
March 24, 2014 23:39
Java Exploration in ColdFusion: java.io.LineNumberReader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Create the line reader. ---> | |
<cfset objLineReader = CreateObject( | |
"java", | |
"java.io.LineNumberReader" | |
).Init( | |
<!--- Buffered Reader. ---> | |
CreateObject( | |
"java", | |
"java.io.BufferedReader" | |
).Init( | |
<!--- File reader. ---> | |
CreateObject( | |
"java", | |
"java.io.FileReader" | |
).Init( | |
<!--- File path. ---> | |
JavaCast( "string", ExpandPath( "./data.txt" ) ) | |
) | |
) | |
) /> | |
<!--- Get first line. ---> | |
<cfset REQUEST.LineData = objLineReader.ReadLine() /> | |
<!--- Loop while we still have line data. ---> | |
<cfloop condition="StructKeyExists( REQUEST, 'LineData' )"> | |
<!--- Get the line number. ---> | |
<cfset intLineNumber = objLineReader.GetLineNumber() /> | |
<!--- Output line data. ---> | |
#intLineNumber#) #REQUEST.LineData#<br /> | |
<!--- Read the next line. ---> | |
<cfset REQUEST.LineData = objLineReader.ReadLine() /> | |
</cfloop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment