Re: Read binary data file
- From: Martin Gregorie <martin@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 01 Sep 2007 13:40:27 +0100
~kurt wrote:
>
I understand Hunter's comments, and and while I don't know much about
ASN.1 encoding, what I am pointing out is that binary files are usually
*not* intended to be used across sytems.
I think its use is quite industry-dependent: I've never seen it used in financial messaging (that's more likely to use SWIFT formats, which are tagged text) but its common in the telecommunications industry.
Telcos (both fixed line and mobile) use a lot of binary data for control and accounting purposes, mainly because this minimizes message size and there's a LOT of stuff flying around controlling the network in real time and accounting for its use. Switches from large vendors, e.g. Erickson, tend to use proprietary, flat message formats but if the data will be exchanged between different types of kit (e.g. roaming billing data) they tend to use ASN.1: CCITT likes it.
ASN.1 has a lot in common with XML in that its a tagged field protocol, allows nesting, and uses a tag dictionary to associate meanings with tags. Compared with XML its a LOT more compact (tags are one byte, fixed length fields don't have terminators, variable length fields are preceded by a one or two byte length) and it has a number of predefined field types as well as arrays. If you have the dictionary its easy to interpret on the fly though, like XML, you can also use the dictionary to generate code to encode and decode ASN.1 records.
Every binary data file I have>
ever worked with was intended to be used either by the program that wrote
it, or separate applications that used the same utility libraries as the
application which wrote the data.
There's also a lot of binary data in large commercial systems. Formerly it was in large serial files, then flat indexed files, now its probably in a database. A really good reason for using an RDBMS is that it not only hides implementation details (like endian conventions) from the application, but the interfaces (SQL, JDBC, ODBC, etc) typically provide field conversion facilities.
There is nothing wrong with simply writing>
the C structure to a file, and reading it in the same way.
I'd probably use a CSV format any place where a database would be obvious overkill, but ymmv.
Using CSV rather than binary makes debugging easier and (said with his *NIX hat on) it allows the data to be handled by common scripted utilities like awk, perl and even shell scripts. Oh yeah, Java too :-)
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
.
- References:
- Re: Read binary data file
- From: ~kurt
- Re: Read binary data file
- Prev by Date: Re: about logon failure
- Next by Date: Re: Enumset
- Previous by thread: Re: Read binary data file
- Next by thread: Re: Read binary data file
- Index(es):
Relevant Pages
|
|