Storing Byte arrays and strings in the same file

I am making a program which requires me to store login information for users. I already have the code set up which creates a hashed Byte[] array of their passwords and salts them with another Byte[]. I would like to store their username, their password, and their salt in the same file, preferably something like username,password,hash.

All I have found so far are examples of storing only a Byte array. If anyone could point me in the right direction for writing and reading files like that, it would be great.

Thank you for any help you can give me.

Jon Skeet
people
quotationmark

The simplest option would probably be to just convert the byte arrays to text using base64 or hex (not calling new String(bytes)) and then just use a property file or any other text storage scheme you fancy.

You could go the other way, and store everything in a binary format (e.g. using a length-prefixed message for both bytes and strings) but my experience is that the readability of text files is huge boon to development.

people

See more on this question at Stackoverflow