Posted By: Dion Mendel
Date: 2011-01-24 16:13
Summary: BinData 1.3.0
Project: BinData

= BinData is a declarative way to read and write structured binary data.

This release includes several major changes.

* You can now provide an initial value when creating a BinData object.
* Support for bit-based fields is much improved.
* Reference manual has had a major update - checkout the syntactic sugar for Arrays and Choices.
* More example code.
* Speedups.
* Backwards incompatible changes. Should only affect advanced users. See NEWS file for details.

If you use BinData and have any comments, suggestions or questions, feel free to email me.

== What is BinData?

Do you ever find yourself writing code like this?

io =
len ="v")
name =
width, height ="VV")
puts "Rectangle #{name} is #{width} x #{height}"

It's ugly, violates DRY and feels like you're writing Perl, not Ruby.

Here's how you'd write the above using BinData.

class Rectangle < BinData::Record
. endian :little
. uint16 :len
. string :name, :read_length => :len
. uint32 :width
. uint32 :height

io =
r =
puts "Rectangle #{} is #{r.width} x #{r.height}"

BinData supports all the data types you expect, including; arbitrarily sized/signed/endian integers, floats, bitstrings, strings, null terminated strings, dependent fields, arrays, choices, nested structures, and user defined structures.

Latest News
TZInfo::Data v1.2014.2 Released
    Philip Ross - 2014-03-25 22:32
TZInfo v0.3.39 Released
    Philip Ross - 2014-03-09 20:23
TZInfo::Data v1.2014.1 Released
    Philip Ross - 2014-03-09 20:00
Automatic Ruby 14.2.0 has been released!
    id 774 - 2014-02-26 06:23
kramdown 1.3.2 released
    Thomas Leitner - 2014-02-16 08:35


Forums | Admin

Discussion Forums: bindata-1.3.0

Start New Thread Start New Thread


Topic Topic Starter Replies Last Post