Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

looking for C-friendly encoding method for small chunks of information

Thread view: 
bobrich@gmail.com - 13 Jul 2006 15:47 GMT
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
Chris Uppal - 13 Jul 2006 16:18 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.