Skip to main content
vipran
Participant
Oct 11, 2015 10:42 PM UTC
Question

coldfusion need to read the file and pass the bytes[].

need to read the file and pass the bytes[].

Can i create a java object and use it in coldfusion like below please help:

pathOb = createObject("java", "java.nio.file.Paths");

files = createObject("java", "java.nio.file.Files");

path = pathOb.get("file"); data = Files.readAllBytes(path)

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

EddieLotter
Inspiring
Oct 13, 2015 9:53 PM UTC

It's worth noting that you do not have to do this in JAVA, you can use the cfFile tag in ColdFusion.

Cheers

Eddie

Translate
BKBK
Community Expert
Community Expert
Oct 13, 2015 6:26 PM UTC

Yes, you may do that. As long as the class paths are valid.

Take this basic Java object as example

<cfset str1 = createobject("java","java.lang.String").init("Bat")>

<cfset str2 = str1.concat("man")>

<cfoutput>#str2#</cfoutput>

Translate