Writing AppleDouble file header, How?

  • Thread starter Thread starter Søren M. Olesen
  • Start date Start date
S

Søren M. Olesen

Hi

What would be the easiest way, to write an 'AppleDouble file header' to a
file, from vb.net??

AppleDouble file header:
--------------------------------------------------------------------------------
Field Length
--------------------------------------------------------------------------------
Magic number 4 bytes
Version number 4 bytes
Home file system 16 bytes. ASCII encoded
Number of entities 2 bytes
Entry descriptor for each entry
Entry ID 4 bytes
Offset 4 bytes
Length 4 bytes

also it needs to be written in 'Big Endian byte order'

TIA

Søren
 
Yeah, but I was kind of wondering if I could create classes/structs holding
the information, and then serialize these to the disk.

Søren
 
If I interpret your question correctly, you're asking if you can use .NET's
built-in Serialize and Deserialize methods to somehow directly translate an
AppleHeader (with appropriate strongly-typed properties) class back and
forth to its binary representation. While this is possible, your header
structure is so simple that I would recommend you just write simple encoder
and decoder methods. It's my guess that you'd have to do this anyway to
override the default "endianess" of specific properties. Not to mention
that you'd have to do a binary edit on the destination file one you
"serialized" the class to its Byte array. Have a look at the BinaryReader
and BinaryWriter classes.

- Mitchell S. Honnert
 
Back
Top