This is kind of a n00b question.
I'm writing some code in Java to read messages of four fields passed in
from an ActiveX control written in C. There are two integers and two
strings in the message, and the whole thing will be encrypted.
I'm looking for something a bit more elegant/less cheesy than using a
single delimited string to pass all of this information. ASN.1 looks
like the perfect technology for the problem..compact/formalized/has
code generators/etc...but it seems to be a bit overkill.
Any recommendations? Is my assessment of ASN.1 for this use fairly
correct?
Thanks
Bob
> I'm looking for something a bit more elegant/less cheesy than using a
> single delimited string to pass all of this information. ASN.1 looks
> like the perfect technology for the problem..compact/formalized/has
> code generators/etc...but it seems to be a bit overkill.
Overkill is an understatement ;-)
More to the point, presumably you want to do this with the least possible fuss,
and I don't think there is anything simpler than either:
a) Encoding it as text in a string. That assumes that the strings data itself
is not difficult to recognise and parse (quite possibly not true).
b) Encoding it binary in a byte[] array. In that case you would have to
specify the size and byte order of the representations of the two integers
(say, 4-bytes, little-endian, unsigned). And would have to specify the
encoding of the binary representation of the String data (say UTF-16LE,
preceded by a 32-bit length indicator).
Either is simple to implement, if you need further pointers ask again.
-- chris