H5Array Conversion

Hey all:

Does anyone know an easy way to convert an H5Array<Byte> object back to a Byte[]?
Thanks.

DB

···

--
Donald Brandon
228-424-3958 (cell)
http://www.brandondl.com

Don, currently, there's no way to do that conversion and, frankly,
H5Array<T> is not intended to be used as some kind of array substitute.
The only reason to use H5Array<T> is to pass .NET arrays
to methods like H5D.read/write(..., new H5Array<T>(your_array)).
Why can't you just hang on to 'your_array' ?

Best, G.

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of Donald Brandon
Sent: Sunday, September 04, 2011 12:29 AM
To: HDF Users Discussion List
Subject: [Hdf-forum] H5Array Conversion

Hey all:

Does anyone know an easy way to convert an H5Array<Byte> object back to a
Byte[]?
Thanks.

DB

--
Donald Brandon
228-424-3958 (cell)
http://www.brandondl.com

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hey Gerb:

I seen where you responded to this e-mail. Thank you, but I seem to have lost your response somehow. In it, you had mentioned holding onto my original array. I think I may be missing something.

I am trying to read an attribute and its value. I can get the attribute name but need to figure out how to get the value.
Here is what I am currently doing:

H5Array<Byte> buffer2 = new H5Array<Byte>(ConvertToBytes(buffer));
H5A.read(curAttID, curAttNativeType, buffer2);

The original buffer is just an empty Byte[]. I convert it to an H5Array and populate it with H5a.read(). So the original array won't do me any good. How do I get a string out of the H5Array? H5Array.ToString() will not do it.

Thanks,
DB

···

On 9/4/2011 12:29 AM, Donald Brandon wrote:

Hey all:

Does anyone know an easy way to convert an H5Array<Byte> object back to a Byte[]?
Thanks.

DB

--
Donald Brandon
228-424-3958 (cell)
http://www.brandondl.com

Don, how about this:

byte[] my_array = ConvertToBytes(buffer);
H5A.read(curAttID, curAttNativeType, new H5Array<Byte>(my_array));

// now do something with my_array

H5Array<T> is really just a shell game. If you look at the (C++) source
code, you'll see that no new arrays/elements are being allocated.
Only references are being passed around.

Best, G.

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of Donald Brandon
Sent: Sunday, September 04, 2011 11:16 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] H5Array Conversion

Hey Gerb:

I seen where you responded to this e-mail. Thank you, but I seem to have
lost your response somehow. In it, you had mentioned holding onto my
original array. I think I may be missing something.

I am trying to read an attribute and its value. I can get the attribute
name but need to figure out how to get the value.
Here is what I am currently doing:

H5Array<Byte> buffer2 = new H5Array<Byte>(ConvertToBytes(buffer));
H5A.read(curAttID, curAttNativeType, buffer2);

The original buffer is just an empty Byte[]. I convert it to an H5Array
and populate it with H5a.read(). So the original array won't do me any
good. How do I get a string out of the H5Array? H5Array.ToString() will
not do it.

Thanks,
DB

On 9/4/2011 12:29 AM, Donald Brandon wrote:
> Hey all:
>
> Does anyone know an easy way to convert an H5Array<Byte> object back
> to a Byte[]?
> Thanks.
>
> DB
>

--
Donald Brandon
228-424-3958 (cell)
http://www.brandondl.com

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Wow! Well that was easy. I guess I wasn't seeing it like that.
Once again, thank you.

DB

···

On 9/4/2011 11:27 AM, Gerd Heber wrote:

Don, how about this:

byte[] my_array = ConvertToBytes(buffer);
H5A.read(curAttID, curAttNativeType, new H5Array<Byte>(my_array));

// now do something with my_array

H5Array<T> is really just a shell game. If you look at the (C++) source
code, you'll see that no new arrays/elements are being allocated.
Only references are being passed around.

Best, G.

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of Donald Brandon
Sent: Sunday, September 04, 2011 11:16 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] H5Array Conversion

Hey Gerb:

I seen where you responded to this e-mail. Thank you, but I seem to have
lost your response somehow. In it, you had mentioned holding onto my
original array. I think I may be missing something.

I am trying to read an attribute and its value. I can get the attribute
name but need to figure out how to get the value.
Here is what I am currently doing:

H5Array<Byte> buffer2 = new H5Array<Byte>(ConvertToBytes(buffer));
H5A.read(curAttID, curAttNativeType, buffer2);

The original buffer is just an empty Byte[]. I convert it to an H5Array
and populate it with H5a.read(). So the original array won't do me any
good. How do I get a string out of the H5Array? H5Array.ToString() will
not do it.

Thanks,
DB

On 9/4/2011 12:29 AM, Donald Brandon wrote:

Hey all:

Does anyone know an easy way to convert an H5Array<Byte> object back
to a Byte[]?
Thanks.

DB

--
Donald Brandon
228-424-3958 (cell)
http://www.brandondl.com

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Donald Brandon
228-424-3958 (cell)
http://www.brandondl.com