Re: Reading a C struct in java
Mark wrote:
On Wed, 30 Sep 2009 12:36:34 +0000 (UTC), Martin Gregorie
<martin@address-in-sig.invalid> wrote:
On Wed, 30 Sep 2009 09:08:54 +0100, Mark wrote:
On 29 Sep 2009 15:10:36 GMT, "Kenneth P. Turvey" <evoturvey@gmail.com>
wrote:
.../....
How does it arrive in your code? Is this the result of a native call?
No. There must be no native code. In fact the project is a port from
native code.
The data arrives from another Java package which handles the network
protocol.
In that case why are you talking about a C struct? Just swipe the code
from the Java class that replaced the C struct.
The message format is described in terms of a C structure. There is
no extant code to "replace" the C struct.
I strongly suggest getting away from describing it in terms of a C
structure, because it just does not give useful data. Several of us have
effectively answered different questions because of the lack of clarity.
Here is an example of how I might describe one interpretation of your
data format:
type: 1 byte, ascii, valid values 'a', 'b', 'c'.
length: 6 bytes, unsigned decimal in ascii, digits '0' through '9'.
acknowledge: 1 byte, binary, zero represents false, all other values
accepted and represent true.
duplicate: 1 byte, binary, zero represents false, all other values
accepted and represent true.
Can you describe your data stream as it really is in that sort of form?
Patricia