Add array-friendly Encode and Decode with offset & length

Test Plan: unit tests

Reviewers: tberman

Reviewed By: tberman

CC: serdar, stephan, justin, tberman

Differential Revision: http://phabricator.thefactory.com/D1676