[google-appengine] Re: Compressed string extractable in appengine?

2008-11-20 Thread Daniel O'Brien (Google)

The following should work, if you haven't tried something along these
lines already.

Java:

String inputString = Hello, world!;
byte[] input = inputString.getBytes(UTF-8);

byte[] output = new byte[100];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
compresser.deflate(output);

FileOutputStream out = null;
try {
  out = new FileOutputStream(some_temp_file);
  out.write(output);
} finally {
  out.close();
}

Python:

import zlib
zlib.decompress(data)
print data

Let me know if you run into any trouble,

Daniel

On Nov 19, 4:30 pm, jago [EMAIL PROTECTED] wrote:
 Hi,

 I want to create a compressed String in Java and send it to the
 appengine where it is decompressed. Can somebody help me to do this?

 So far I used GZIP for compression in Java. Extraction in appengine
 didn't work though.

 Using the ZIP format in Java resulted also in not more luck. Does
 somebody have example codes on both sides that is known to work?

 Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Compressed string extractable in appengine?

2008-11-20 Thread jago

Thanks...worked great.

On Nov 20, 7:37 pm, Daniel O'Brien (Google) [EMAIL PROTECTED] wrote:
 The following should work, if you haven't tried something along these
 lines already.

 Java:

     String inputString = Hello, world!;
     byte[] input = inputString.getBytes(UTF-8);

     byte[] output = new byte[100];
     Deflater compresser = new Deflater();
     compresser.setInput(input);
     compresser.finish();
     compresser.deflate(output);

     FileOutputStream out = null;
     try {
       out = new FileOutputStream(some_temp_file);
       out.write(output);
     } finally {
       out.close();
     }

 Python:

     import zlib
     zlib.decompress(data)
     print data

 Let me know if you run into any trouble,

 Daniel

 On Nov 19, 4:30 pm, jago [EMAIL PROTECTED] wrote:

  Hi,

  I want to create a compressed String in Java and send it to the
  appengine where it is decompressed. Can somebody help me to do this?

  So far I used GZIP for compression in Java. Extraction in appengine
  didn't work though.

  Using the ZIP format in Java resulted also in not more luck. Does
  somebody have example codes on both sides that is known to work?

  Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---