Re: [Py4j-users] Create "new <object>"?
Status: Beta
Brought to you by:
barthe
From: Alex G. <ale...@ne...> - 2015-03-30 20:53:38
|
30.03.2015, 19:35, Israel Brewster kirjoitti: > Except that looses the "new" command. That is, my java code is: > > InputStream data=new ByteArrayInputStream(jsonData.getBytes("UTF-8")); > > Not > > InputStream data=ByteArrayInputStream(jsonData.getBytes("UTF-8")); > > Unless in Java that doesn't matter? Or perhaps I'm missing something > about the way py4j works, i.e. there's an implicit "new" call? Classes are instantiated with py4j exactly the same way as in Python generally: by calling the class itself. In Java, the "new" operator is not optional. In Python (and py4j), it simply doesn't exist. > > ----------------------------------------------- > Israel Brewster > Systems Analyst II > Ravn Alaska > 5245 Airport Industrial Rd > Fairbanks, AK 99709 > (907) 450-7293 > ----------------------------------------------- > > > > > >> On Mar 27, 2015, at 3:42 PM, Barthelemy Dagenais >> <bar...@in... <mailto:bar...@in...>> wrote: >> >> Hi, >> >> how about: >> >> data = >> gateway.jvm.java.io.ByteArrayInputStream(jsonData.getBytes("UTF-8")) >> >> References in the documentation: >> http://py4j.sourceforge.net/faq.html#how-to-call-a-constructor >> http://py4j.sourceforge.net/getting_started.html#collections-help-and-constructors >> >> On Fri, Mar 27, 2015 at 1:36 PM, Israel >> Brewster<is...@ra... <mailto:is...@ra...>>wrote: >> >> Is there a way in py4j to call the java "new" command? That is, >> in java I have some code like: >> >> InputStream data=new ByteArrayInputStream(jsonData.getBytes("UTF-8")); >> >> Is there a way to pull that across to the python side, or do I >> just have to make a bunch of utility functions in Java for this? >> >> I'm trying to make the Jasper Reports library available to my >> python code, and while it works for the most part I haven't yet >> figured out object creation. Thanks. >> ----------------------------------------------- >> Israel Brewster >> Systems Analyst II >> Ravn Alaska >> 5245 Airport Industrial Rd >> Fairbanks, AK 99709 >> (907) 450-7293 <tel:%28907%29%20450-7293> >> ----------------------------------------------- >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel >> Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is >> your hub for all >> things parallel software development, from weekly thought >> leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and >> join the >> conversation now.http://goparallel.sourceforge.net/ >> _______________________________________________ >> Py4j-users mailing list >> Py4...@li... >> <mailto:Py4...@li...> >> https://lists.sourceforge.net/lists/listinfo/py4j-users >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your >> hub for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation >> now.http://goparallel.sourceforge.net/_______________________________________________ >> Py4j-users mailing list >> Py4...@li... >> <mailto:Py4...@li...> >> https://lists.sourceforge.net/lists/listinfo/py4j-users > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > > > _______________________________________________ > Py4j-users mailing list > Py4...@li... > https://lists.sourceforge.net/lists/listinfo/py4j-users |