lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: pass compressed string
Date Thu, 24 Feb 2011 02:42:04 GMT

On Thu, 24 Feb 2011, Roman Chyla wrote:

> I would like to transfer results from python to java:
>
> hello = zlib.compress("hello")
>
> on the java side do:
>
> byte[] data = string.getBytes()
>
> But I am not successful. Is there any translation going on somewhere?

Can you be more specific ?
Actual lines of code, errors, expected results, actual results...

An array of bytes in JCC is not created with a string but a 
JArray('byte')(len or str)

   >>> import lucene
   >>> lucene.initVM()
   <jcc.JCCEnv object at 0x1004100d8>
   >>> lucene.JArray('byte')(10)
   JArray<byte>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
   >>> lucene.JArray('byte')("abcd")
   JArray<byte>(97, 98, 99, 100)
   >>>

Andi..

Mime
View raw message