Simplify ByteArray handling.

The native functions on Windows/OS X now ensure that the passed
bytearrays are big enough to read all data into them instead of
aborting the API call.

On Linux, we don't try to restore the bytearray position when writing
a ticket into it anymore, as this isn't done in the native lib either.
Instead, just overwrite the whole bytearray.