Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String compression

Status
Not open for further replies.

Kruzer

Programmer
Jun 16, 2000
117
US
What Java class would be the "best" for compressing strings? I'm writting an app were I'm sending xml messages from one app to another (I'm new to JMS) and I'd like to try compressing the message further. Any suggestions?

Dano
dan_kryzer@hotmail.com
What's your major malfunction
 
This could be helpful:

import java.io.*;
import java.util.zip.*;

public class SaveEmployee {
public static void main(String argv[]) throws
Exception {
// create some objects
Employee sarah = new Employee("S. Jordan", 28,
56000);
Employee sam = new Employee("S. McDonald", 29,
58000);
// serialize the objects sarah and sam
FileOutputStream fos = new
FileOutputStream("db");
GZIPOutputStream gz = new GZIPOutputStream(fos);
ObjectOutputStream oos = new
ObjectOutputStream(gz);
oos.writeObject(sarah);
oos.writeObject(sam);
oos.flush();
oos.close();
fos.close();
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top