Add support for padding and truncation.
Merge pull request #9 from btd/patch_padding

Add support for padding and truncation.