Hi all,

I know how to create a gzipped file on the local file system by using
the GZIPOutputStream class. Want I want to do is create a gzipped file
on a remote file system by using the JSch SFTP methods.

I've gzipped the byte[] of data and am passing that as an InputStream
to the JSch library for SFTPing to a remote file directory (as a .gz
file). However, the file that is delivered has a bad EOL character and
cannot be 'gunzipped'. The SSCE is as follows:

byte[] content = "Content".getBytes();
// Lots of work inside gzipContent method call
// It does work (I promise!) returns a 'gzipped' byte[]
byte[] gzippedContent = gzipContent(content);
ByteArrayInputStream bais = new ByteArrayInputStream(gzippedContent);
channelSftp.put(bais, "Content.txt.gz");

The resulting file always has a bad EOL character. I can't see of
another method that would do the trick - which means I think I'm
missing some fundamental point.

Or I might not be - apparently the JZlib sub lib with Jsch does not
support the Gzip format, so it may not be possible to 'stream' a
gzipped byte array using this library. Not sure if that's a Red
Herring though...

Any ideas?  I'm stumped :)

Cheers,
Martijn

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to