Unfortunately, using your code (except using createObject instead of
javaloader, as I have the library in CF's classpath), I get the same
error.

On Wed, Sep 15, 2010 at 10:52 AM, Dorioo <dor...@gmail.com> wrote:
>
> If I recall correctly, I experienced problems when using just a file name as
> well. But was successful by using constructor using the filename, delimeter,
> and charset. I hope you can see what changes you're need from the code below
> which works within the context of my app but doesn't work on its own.
>
>
> <cffunction name="getReader" output="false" access="public" returntype="any"
> hint="Returns the reader object">
>    <cfargument name="fileName"  required="true"
> type="string"                      hint="The full path to the filename">
>    <cfargument name="delimiter" required="true"
> type="string"                      hint="The delimiter">
>    <cfargument name="charset"   required="false" type="string"
> default="Cp1252" hint="The text encoding. Default is Cp1252. The same
> default for coldfusion.">
>
>    <!--- Create reader --->
>    <cfset var csvreader =
> controller.getPlugin("JavaLoader").create("com.csvreader.CsvReader")>
>
>    <!--- Create a charset object to pass to the function --->
>    <cfset var charsetObject =
> createObject("java","java.nio.charset.Charset").forName(arguments.charset)>
>
>    <!--- Readobject --->
>    <cfset var readObject =
> csvreader.init(arguments.fileName,arguments.delimiter,charsetObject)>
>
>    <cfreturn readObject>
> </cffunction>
>
> - Gabriel
>
>
> On Wed, Sep 15, 2010 at 10:33 AM, Rick Root <rick.r...@gmail.com> wrote:
>
>>
>> BTW in my own interest, having never actually used the CsvReader class
>> (only the CsvWriter class), I started to attempt to write some sample
>> code...
>>
>> Unfortunately, this is as far as I got :)
>>
>>
>> <cfset filename = "test.csv">
>> <cfset fileInput = createObject("java","com.csvreader.CsvReader")>
>> <cfset fileInput.init(filename)>
>> <cfset fileInput.close()>
>>
>>
>> The third line errors with the following error:
>>
>> An exception occurred when instantiating a Java object. The class must
>> not be an interface or an abstract class.
>>
>> Which I don't get because the CsvReader class is neither an abstract
>> class nor an interface.
>>
>> Oh well, I tried =)
>>
>> Rick
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337073
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to