Thread View: borland.public.jbuilder.java.api
6 messages
6 total messages
Started by Roy Blinng
Thu, 05 Jun 2003 18:06
bitconverter
Author: Roy Blinng
Date: Thu, 05 Jun 2003 18:06
Date: Thu, 05 Jun 2003 18:06
6 lines
1117 bytes
1117 bytes
hi, which java package should import to use bitconverting routines? how can i also convert byte[] to double? double to byte[]? if i read a blob data from database and convert that byte[] to double, will there be a bigendian or little endian problem? how can i solve this? thanks,
Re: bitconverter
Author: Kevin Dean
Date: Thu, 05 Jun 2003 19:35
Date: Thu, 05 Jun 2003 19:35
26 lines
2036 bytes
2036 bytes
In short, you can't. Java doesn't deal with big-endian and little-endian issues because it guarantees that the external representation of all integer types is portable across JVM's. Similarly, it doesn't give you direct access to pointer address or array bases. What exactly are you trying to do? -- Check out our latest white papers at http://www.datadevelopment.com/papers/index.html BladeNET Scores With Borland Enterprise Tools Team Development with JBuilder and Borland Enterprise Server Dolphin Data Development Ltd. http://www.datadevelopment.com/ "Roy Blinng" <royb45108@hotmail.com> wrote in message news:3edf86be@newsgroups.borland.com... > hi, > which java package should import to use bitconverting routines? > how can i also convert byte[] to double? double to byte[]? > if i read a blob data from database and convert that byte[] to double, > will there be a bigendian or little endian problem? how can i solve this? > thanks, > >
Re: bitconverter
Author: Roy Blinng
Date: Thu, 05 Jun 2003 20:01
Date: Thu, 05 Jun 2003 20:01
9 lines
1395 bytes
1395 bytes
I will read a blob data from my database to a variable byte[]. then i will convert that byte[] to double. >because it guarantees that the external representation >of all integer Does this blob data contain the information about which significant byte is stored first? if not, it wouldnt be a good solution for converting byte[] to double. Regards,
Re: bitconverter
Author: Kevin Dean
Date: Thu, 05 Jun 2003 21:55
Date: Thu, 05 Jun 2003 21:55
30 lines
2126 bytes
2126 bytes
If you're reading a blob from a database, it will be restored in the byte array in the order in which it was stored in the database; there is no conversion of any form. As for parsing out doubles etc. from it, I'm afraid I can't think of any way for doing that. -- Check out our latest white papers at http://www.datadevelopment.com/papers/index.html BladeNET Scores With Borland Enterprise Tools Team Development with JBuilder and Borland Enterprise Server Dolphin Data Development Ltd. http://www.datadevelopment.com/ "Roy Blinng" <royb45108@hotmail.com> wrote in message news:3edfa0df@newsgroups.borland.com... > I will read a blob data from my database to a variable byte[]. > then i will convert that byte[] to double. > > >because it guarantees that the external representation > >of all integer > Does this blob data contain the information about which significant byte is > stored first? if not, it wouldnt be a good solution for converting byte[] to > double. > Regards, > >
Re: bitconverter
Author: John McGrath TeamB
Date: Fri, 06 Jun 2003 04:29
Date: Fri, 06 Jun 2003 04:29
17 lines
1577 bytes
1577 bytes
On Thu, 5 Jun 2003 17:55:39 -0400, Kevin Dean wrote:
> As for parsing out doubles etc. from it, I'm afraid
> I can't think of any way for doing that.
You can do that by packing the bytes into a long value in the order of
your choosing using shift and masking operators and then converting the
long value to a double using Double.longBitsToDouble().
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: bitconverter
Author: Kevin Dean
Date: Fri, 06 Jun 2003 11:36
Date: Fri, 06 Jun 2003 11:36
32 lines
2255 bytes
2255 bytes
Thanks John. I've never had a need to do that kind of bit manipulation in Java but it's nice to know it's there. That will come in handy someday. -- Check out our latest white papers at http://www.datadevelopment.com/papers/index.html BladeNET Scores With Borland Enterprise Tools Team Development with JBuilder and Borland Enterprise Server Dolphin Data Development Ltd. http://www.datadevelopment.com/ "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:MPG.1949e2cadcc6a3f598bfd3@newsgroups.borland.com... > On Thu, 5 Jun 2003 17:55:39 -0400, Kevin Dean wrote: > > > As for parsing out doubles etc. from it, I'm afraid > > I can't think of any way for doing that. > > You can do that by packing the bytes into a long value in the order of > your choosing using shift and masking operators and then converting the > long value to a double using Double.longBitsToDouble(). > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads