IntelliJ Java IDE
The moose likes Sockets and Internet Protocols and the fly likes Auto-compression of sent data? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "Auto-compression of sent data?" Watch "Auto-compression of sent data?" New topic
Author

Auto-compression of sent data?

Gerry Giese
Ranch Hand

Joined: Aug 02, 2001
Posts: 247
Hi all - is there a way to send data across a socket connection that is compressed automatically instead of pre-compressing the data and then sending it? Thanks!


CJP (Certifiable Java Programmer), AMSE (Anti-Microsoft Software Engineer)<br />Author of <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi" target="_blank" rel="nofollow">Posts in the Saloon</a>
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Sure, wrap the OutputStream created on the socket with a GzipOutputStream. Any byte array you write to it will be compressed and sent in one call.
------------------
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
IntelliJ Java IDE
 
subject: Auto-compression of sent data?
 
Threads others viewed
PrintWriter vs OutputStream
RMI error
JComboBox Problem...Help
JTree and JTable
wordings for error message
developer file tools