ZLib problem

Hi,
I juz started making a Jump’n’run engine.
So we need an editor.
Now we are @ the part to save the finished map.
I want to save the data as a Base64 encoded ZLib Compressed String.
Earlier i used Ruby to compress and encode the string, now i want to use java.
But the result of the Compression is kinda buggy, it always gives me:
java.util.zip.DataFormatException: incorrect header check

The Inflater part should be OK, becauze it worked earlier fine.
I think its a problem how i compressed the string.
Heres my code:


        byte[] bytes = (String)layerCodes[i].getBytes("UTF-8");
        bytelength=bytes.length;
        byte[] output = new byte[bytes.length];
        Deflater compresser = new Deflater();
        compresser.setInput(bytes);
        compresser.finish();
        int compressedDataLength = compresser.deflate(output);
        layerCodes[i] = new String(output, 0, compressedDataLength, "UTF-8");
        layerCodes[i] = Base64Decoder.encodeString(layerCodes[i].trim());

I dont get it what i’ve done wrong;


        byte[] output = new byte[bytes.length];

Have i to put the exact output lenght?

Base64 En/De-Coder: http://www.source-code.biz/base64coder/java/

Edit:
A clean result should look like this:


eJwz0DHQMbYwswYABtMBlQ==

But thats the result from Java method:


eO+/vTPvv70x77+9

._.
Something have to be wrong, the base64 encoder`? but i printed the String before encoding and after decoding, they was the same.

Edit: solved, juz kiked the compression out of my code