I have a CFC I wrote that has many spool file functions in it, one of
which reads a spool file and returns it as text.  Well, my issue is that
the byte reader is incredibly slow for 50 - 100+ page documents.  I see
a few other stream file read methods in the java api, but I cannot
figure out how to invoke them properly.  Has anyone else done this
before, or have a function that uses Java to read a spool file?  Here is
my function to read currently (which is way too slow).

<cffunction name="getSpoolFile" returntype="any" hint="Returns a
formatted spool file from the AS400 - required the getSpoolFileList
function be executed first!">
                <cfargument name="index" required="true" type="numeric"
hint="Index of the spool file to be retrieved">
                
                <cfset var spoolData = '' />
                <cfset var buffer = '' />
                
                <!---// Set my print parameters based on incoming
arguments.format //--->
                <cfset
PrintParameterList.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT
, "/QSYS.LIB/QWPDEFAULT.WSCST") />
                <cfset
PrintParameterList.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST") />
                
                <!---// Load spool file into memory as an object //--->
                <cfset spoolObj =
SpooledFileList.getObject(numberFormat(arguments.index)) />
                
                <!---// Return a transformed input stream //--->
                <cfset spoolFile =
spoolObj.getTransformedInputStream(PrintParameterList) />
                                
                <cfset savechar = 1 />
                <cfloop condition="savechar neq -1">
                        <!---// Read one byte from our file //--->
                        <cfset savechar = spoolFile.read() />
                        
                        <cfif savechar eq -1>
                                <cfbreak>
                        </cfif>
                        
                        <!---// This will format the save file to be
printed properly from the web //--->
                        <cfswitch expression="#savechar#">
                                <cfcase value="32">
                                        <cfset buffer = buffer & ' ' />
                                </cfcase>
                                <cfcase value="12">
                                        <cfset buffer = buffer & '<p
style="page-break-after: always"></p>' />
                                </cfcase>
                                <cfdefaultcase>
                                        <cfset buffer = buffer &
chr(savechar) />
                                </cfdefaultcase>
                        </cfswitch>
                                                        
                </cfloop>
                
                <cfset spoolData = buffer />            
        
                <cfreturn spoolData />
        </cffunction>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:277262
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to