Java Serialization to transfer data between any language -


question:

instead of writing own serialization algorithm; possible use built in java serialization, have done below, while still having work across multiple languages?


explanation:

how imagine working, follows: start process, be language-specific program - written in language. i'd have cppexecutor.exe file, example. write data stream program. program needs do, return result.

to this, need serialize data in way. first thing came mind basic java serialization use of objectinputstream , objectoutputstream. of have read has stated java serialization java-to-java applications.

none of data ever need stored in file. method of transferring these packets through java.lang.process, have set already.

the data composed of following:

  • string - containing information displayed user.
  • integer - 32-bit. won't need deal times.
  • float- handle floating-point values.
  • character - ensure proper types used.
  • array - composed of of elements in list.

the best way have worked out how follows: start 4-byte magic number - ensure working correct data. following, have integer specifying how many elements there are. after that, each of elements have: single byte, signifying data type (of above), following crucial information, e.x: length string , array. then, data follows.


side-notes:

i point out lot of these calculations taking place, every millisecond matter. due this, text-based format (such json) may produce far larger operation times. considering non of packets need interpreted human, using bytes wouldn't issue.

i'd recommend google protobuf: binary, stable, proven, , has bindings languages you've mentioned. moreover, handles structured data nicely.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -