troubleshooting Question

Create a TAR File (tarball) using Coldfusion\Java on a windows server

Avatar of Rob E
Rob E asked on
JavaColdFusion Language
4 Comments1 Solution116 ViewsLast Modified:
I need to create a TAR file containing multiple files on a windows server using Coldfusion\Java. I have found lots of examples of unpacking them, but very little on creating them. I found this example of using gzip to add some text to a file and that works, but I need to add files. I'm also not 100% sure that gzip is the same thing as building a tarball. This project was assigned to me with a very short turn-around and I'm spinning my wheels so any help in the right direction is greatly appreciated:
    
<cfset lineBreak = chr(13) & chr(10) />
    <!--- open the sitemap file --->
    <cfset tarFilePath = "#application.imageingFolder#DTSimages\Pending\tiff.gz" />
    #tarFilePath#
    <!--- create streams --->
    <cfset outputStream = CreateObject("java", "java.io.FileOutputStream").Init(
    			CreateObject("java","java.io.File").Init(tarFilePath)) />
    <cfset gzipStream = CreateObject("java", "java.util.zip.GZIPOutputStream").Init(outputStream) />
    <cfsavecontent variable="siteMapHeader"><?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
    	xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1"
    	xmlns:video="http://www.sitemaps.org/schemas/sitemap-video/1.1">
    </cfsavecontent>
    <cfset siteMapFooter = "</urlset>" />
    <cfset gzipStream.write(ToString(siteMapHeader).GetBytes()) />
    
    <cfset gzipStream.close() />
    <cfset outputStream.close() />

Win Server 2012
ColdFusion 10
Java Version 1.7.0_15
ASKER CERTIFIED SOLUTION
Rob E

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros