RE: How to get fields list in order

2006-11-03 Thread Nelson, Tracy
| From: Christopher Schultz [mailto:[EMAIL PROTECTED] | Sent: Friday, 03 November, 2006 13:41 | | The bottom line to your question is that byte offsets are difficult if | not impossible to predict, and you are better off using getDeclaredField | and getField().getValue() calls. Better yet, write y

Re: How to get fields list in order

2006-11-03 Thread Christopher Schultz
David, >> I'm sorry to say it (again), but I think you're just asking for >> trouble, here. What do you have implemented in Java that's so >> useful and difficult to port to Delphi or VM or (even better) C#? > > What's VM? Whoops. That should have been "VB". > I would really prefer to have this

Re: How to get fields list in order

2006-11-03 Thread David Kerber
Christopher Schultz wrote: ... I read the data from the structures, load it into my classes, do all my processing in java with those regular classes, then write the data back out of the classes into the structures, and pass it back to the calling prog. I'm sorry to say it (again), but I

Re: How to get fields list in order

2006-11-03 Thread Christopher Schultz
Dave, David Kerber wrote: >> JavaDllBuilder looks like it should be used to call Java from another >> language. Are you using this package backwards? > > No, I'm using it to make a .dll in java that I can call from VB and > Delphi. Okay, that makes way more sense. This might be a better question

Re: How to get fields list in order

2006-11-03 Thread David Kerber
Christopher Schultz wrote: Dave, David Kerber wrote: Christopher Schultz wrote: Wait... I thought you said you were using JNI...?! Or, are you using someone else's JNI package to do some dirty tricks? I thought there was only a C binding for JNI thus far. I'm using a 3rd party

Re: How to get fields list in order

2006-11-03 Thread Christopher Schultz
Dave, David Kerber wrote: > Christopher Schultz wrote: >> Wait... I thought you said you were using JNI...?! Or, are you using >> someone else's JNI package to do some dirty tricks? I thought there was >> only a C binding for JNI thus far. > > I'm using a 3rd party package which handles most of th

Re: How to get fields list in order

2006-11-03 Thread David Kerber
Christopher Schultz wrote: ... I don't know C, and don't have access to a C compiler. Wait... I thought you said you were using JNI...?! Or, are you using someone else's JNI package to do some dirty tricks? I thought there was only a C binding for JNI thus far. I'm using a 3rd party p

Re: How to get fields list in order

2006-11-03 Thread Christopher Schultz
David, Since you mentioned byte offsets, I have to ask: are you trying to subvert the serialization system? Or, even worse, inspect the object memory from with JNI? >>> The latter, sort of. I'm using a package which puts a wrapper around >>> JNI to make it easier to creat

Re: How to get fields list in order

2006-11-02 Thread David Kerber
Christopher Schultz wrote: David, Since you mentioned byte offsets, I have to ask: are you trying to subvert the serialization system? Or, even worse, inspect the object memory from with JNI? The latter, sort of. I'm using a package which puts a wrapper around JNI to make it easier

Re: How to get fields list in order

2006-11-02 Thread David Kerber
Christopher Schultz wrote: David, Then I could just check the field type, and increment the byte counter by the appropriate amount (i.e. if the java field type is int, then I know the width in the passed structure is 4 bytes, etc). As Chuck points out, this is unlikely to work. If th

Re: How to get fields list in order

2006-11-02 Thread David Kerber
Caldarale, Charles R wrote: From: David Kerber [mailto:[EMAIL PROTECTED] Subject: Re: How to get fields list in order Then I could just check the field type, and increment the byte counter by the appropriate amount (i.e. if the java field type is int, then I know the width in the passed

Re: How to get fields list in order

2006-11-02 Thread Christopher Schultz
David, > Then I could just check the field type, and increment the byte > counter by the appropriate amount (i.e. if the java field type is > int, then I know the width in the passed structure is 4 bytes, etc). As Chuck points out, this is unlikely to work. If the JIT for the platform decides to

RE: How to get fields list in order

2006-11-02 Thread Caldarale, Charles R
> From: David Kerber [mailto:[EMAIL PROTECTED] > Subject: Re: How to get fields list in order > > Then I could just check the field type, and increment the > byte counter by the appropriate amount (i.e. if the java > field type is int, then I know the width in the passed >

Re: How to get fields list in order

2006-11-02 Thread Christopher Schultz
David, >> Since you mentioned byte offsets, I have to ask: are you trying to >> subvert the serialization system? Or, even worse, inspect the object >> memory from with JNI? > > The latter, sort of. I'm using a package which puts a wrapper around > JNI to make it easier to create windows standard

Re: How to get fields list in order

2006-11-02 Thread David Kerber
Caldarale, Charles R wrote: From: David Kerber [mailto:[EMAIL PROTECTED] Subject: Re: How to get fields list in order To modify return parameters, I need the byte offsets of the various pieces of the structure, which I'm mirroring in my java classes. That's a very scary wa

RE: How to get fields list in order

2006-11-02 Thread Caldarale, Charles R
> From: David Kerber [mailto:[EMAIL PROTECTED] > Subject: Re: How to get fields list in order > > To modify return parameters, I need the byte offsets of > the various pieces of the structure, which I'm mirroring > in my java classes. That's a very scary way to do i

Re: How to get fields list in order

2006-11-02 Thread David Kerber
Christopher Schultz wrote: David, How can I get a list of the public fields declared in a class, *in the order they are declared*? Using Reflection's getFields and getDeclaredFields methods returns them in no particular order, and I need them in the order they are declared so I can get the

Re: How to get fields list in order

2006-11-02 Thread Christopher Schultz
David, > How can I get a list of the public fields declared in a class, *in the > order they are declared*? Using Reflection's getFields and > getDeclaredFields methods returns them in no particular order, and I > need them in the order they are declared so I can get their starting > byte offsets