From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,484b00716058f98f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-07 11:47:46 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!newsfeed.stanford.edu!feed.textport.net!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: JGNAT, Byte arrays, and Stream_Element_Arrays Date: 07 Feb 2001 14:46:10 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <3A806533.8EFCFB0@earthlink.net> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 981575966 16552 128.183.220.71 (7 Feb 2001 19:59:26 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 7 Feb 2001 19:59:26 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6 Xref: supernews.google.com comp.lang.ada:4942 Date: 2001-02-07T19:59:26+00:00 List-Id: "Marc A. Criley" writes: > What is the best way to convert between Java byte arrays, You've tried the "correct Ada way", and the compiler rejected it. So you're stuck. You could send some money to ACT and ask them. On the other hand, if you tell us why you want to do this, maybe there is a better way. Are you importing a serialized object? Then maybe you can re-import the relevant functions, but declare them to use Stream_Element_Array rather than Java.byte_Arr_obj. this might not work, if the pointers really are different. Is Stream_Element actually 8 bits? > as bound to in the Ada form (from Java.ads): > > type byte_Arr_Obj is array (Natural range <>) of byte; > type byte_Arr is access all byte_Arr_Obj; > > and a corresponding Ada.Stream.Stream_Element_Array? > > In similar situations, one might define an access type to > Stream_Element_Array, and then Unchecked_Convert between that type and > byte_Arr. > > However, JGNAT rejects such an instantiation of Unchecked_Conversion, > stating: > > incompatible "jvm" types for unchecked conversion > > Though I don't know the specifics of what's all involved, the idea that > that conversion would not be valid doesn't surprise me. > > So, how does one convert between objects of those types (in bulk)? I'd > hate to think I'd have to traverse the array and unchecked_convert each > individual byte to a Stream_Element. > > Thanks for any suggestions, > > Marc A. Criley > Senior Staff Engineer > Quadrus Corporation > www.quadruscorp.com -- -- Stephe