Implementing zLib compression in Flex and Java -
I am sending some JSON data on the Java side for business processing with my Flex application. Now on top of that, I have added some code to compress the data on Flex and then passed it through the request and it has uncompressed on the Java side. But on the Java layer, uncompressed data is still not in readable / usable format
Flex code for encoding
< Code> var bytes: bytere = new bytere (); Bytes.writeObject (JSON.encode (someObj)); Bytes.position = 0; Bytes.compress (); Variables.encodeJSONStr = Bytes; Requester.data = variable; Loader.load (announcer);
Java code for decoding
string json = req.getParameter ("encodeJSONStr"); Byte [] input = json.getBytes (); Inflator Decompressor = New Inflator (); Decompresser.setInput (input); Byte [] results = new byte [1000]; Int result = 0; ResultsLanguage = decompresser.inflate (Results); Decompresser.end (); String outputString = new string (result, 0, resultant, "UTF-8"); System.out.println ("\ n \ nResultsBath>> <+++
Comments
Post a Comment