comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: JGNAT, Byte arrays, and Stream_Element_Arrays
Date: 07 Feb 2001 14:46:10 -0500
Date: 2001-02-07T19:59:26+00:00	[thread overview]
Message-ID: <upugujmyl.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3A806533.8EFCFB0@earthlink.net

"Marc A. Criley" <mcquadex@earthlink.net> 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



       reply	other threads:[~2001-02-07 19:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3A806533.8EFCFB0@earthlink.net>
2001-02-07 19:46 ` Stephen Leake [this message]
     [not found]   ` <3A829458.19037392@earthlink.net>
2001-02-08 18:28     ` JGNAT, Byte arrays, and Stream_Element_Arrays Stephen Leake
2001-02-08 22:00       ` Marc A. Criley
2001-02-09 14:19         ` Stephen Leake
2001-02-09 16:50           ` Marc A. Criley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox