We're writing Java/Servlets VB/ActiveX
Server compress/decompress XML string data.
No problem when using DeflaterOutputStream and InflaterInputStream
When using java.util.zip.Deflater and java.util.zip.Inflater we get output:
...............................................................
C:\Java\TestCODEC\java TestCODEC
Compressing: Testing CODEC functions...
DataFormatException...
java.util.zip.DataFormatException: invalid stored block lengths
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:194)
at TestCODEC.main(TestCODEC.java:33)
...............................................................
Can anyone help me with this?
for simplicity I've created a simple main() to demonstrate the problem
import java.util.*;
import java.util.zip.*;
import java.io.*;
public class TestCODEC
{
public static void main(String args[])
{
String strData = new String("Testing CODEC functions!!!");
byte[] arrCompData;
byte[] arrDecData;
int MAXBYTES = 1000;
Deflater d = new Deflater();
Inflater i = new Inflater();
arrCoData = new byte[MAXBYTES];
arrDecData = new byte[MAXBYTES];
System.out.println("Compressing: " + strData);
//strData will be passed as
//large XML string (up to 1000000 bytes)
//to the client
d.setInput(strData.getBytes());
d.deflate (arrCoData, 0, MAXBYTES);
String strOutput = new String(arrCoData);
//decompress the data on the client
//VB ActiveX will read the XML
//after decompressing???
i.setInput(strOutput.getBytes());
try
{
i.inflate (arrDecData, 0, MAXBYTES);
String strDec = new String(arrDecData);
System.out.println("Decompressed: " + strDec);
}
catch(DataFormatException e)
{
System.out.println("DataFormatException...");
e.printStackTrace();
}
}
}
Tnx,
><> ------------------------- ><> --------------------------><>
Mark J Radacz E-mail: rada...@yahoo.com
E-Business Development Telephone: (904) 367-9439
RADACZ International: go&Shop@ www.quixtar.com IBO# 2265548
><> ------------------------- ><> --------------------------><>
"Let your heart soar as high as it will. Refuse to be average."
- A.W. Tozer
><> ------------------------- ><> --------------------------><>