Re: offset-based hash table for ASCII data
Rex Mottram wrote:
I'm looking for an offset-based data structure to hold character data.
I'm not sure what you mean by "offset based data structure." I think I
missed that chapter when doing my school work, where the official offset
based data structure that all languages inter-operate with was described.
It sounds like you want just plain old binary data. This is a huge
mistake, imo, since your client and server combination is going to be a
lot less modifiable than just one system by itself. Better to send the
XML to the client, parse the whole thing once into some binary format,
then spawn the child processes. Getting two systems to work together in
a binary format is going to be very hard to maintain.
But anyway, look at DataOutputStream for Java. Send the info to a
network stream, or you can buffer it to memory by hooking the DataOutput
Stream to a ByteArrayOutputStream, and then send the buffer at your leisure.
Think very hard about how you will modify that binary data in the future
when you implement this.
If we knew a little more about what was being parsed here, we might be
able to help you further. My advice is "don't" but you seem wedded to
the idea, so hopefully we can save you from disaster. It's still really
unclear to me how sending data in binary is going to present some huge
savings on the client. Networks are slow, CPUs are fast. Servers also
tend to be heavily loaded. Parsing once in C on the client seems like
the obvious answer and much less headache prone.
Anyway, good luck.
The traditional issue with transportable data structures is that since
the client can't reliably control what address the data is mapped to,
all addressing must be made relative to the starting point. Does anyone
know of an implementation of such a format which can be generated in
Java and consumed in C code?
Re-reading this, I'm still totally unclear on what you are actually
asking here. You need "addressing?" Are you saying you don't know what
indirection is in C? Ever hear of a look-up table? How about a hash table?
That may come off as condescending, but that's what your description
sounds like to me. Maybe a clearer explanation of how you think the
data will be parsed/accessed in binary will help. I think part of the
problem is you are a bit unclear yourself.