Skip to main content

How to read/write binary values?

4 replies [Last post]
jsw
Offline
Joined: 2007-03-22

I'd like to use FastInfoset to store large amounts of floating point numbers. Is there an API for reading and writing binary values? An fi document that contains native types is not as useful if it must be converted to a String to conform to a standard XML API and back to a native type by my application.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
armandj
Offline
Joined: 2006-07-13

Encoding an array of float with length=(1 or 2) will not be overkill concerning compactness as it doesn't take many bits to encode. For arrays less than 3 elements long the length is encoded within the algorithmID identifier octet. So encoding 1 float value should take something like 6 bytes. If FI would support encoding single float value it would still take 6 bytes to encode.

oleksiys
Offline
Joined: 2006-01-25

FI works with primitive types and particular floats.
Here [1] you can find some info and reference to implementation example.

[1] http://forums.java.net/jive/message.jspa?messageID=11540#11554

jsw
Offline
Joined: 2007-03-22

Thanks for the link.
Is there a plan to add support for primitives not wrapped in arrays? A length-one array seems overkill in the general case.

oleksiys
Offline
Joined: 2006-01-25

For now not.
Think there is no much sense to do that, as possible speed improvement for single value seems not be significant, however, if required - you can always do that using length-one array...