static write(contents) {
		var toc = [], length = 0;

		for (var i = 0; i < contents.length; i++) {
			var value = contents[i]
			var isobject = false

			if (value.constructor === Object || value.constructor === Array) {
				value = (contents[i] = JSON.stringify(value))
				isobject = true
			}

			if (typeof value === 'string') {
				toc.push({
					t: 's',
					l: value.length
				});

				if (isobject) {
					toc[toc.length - 1]['o'] = 1;
				}

				length += value.length
			}

			else if (ArrayBuffer.isView(value)) {
				toc.push({
					t: 't',
					l: value.byteLength,
					i: value.constructor.name
				})

				length += value.byteLength
			}

			else if (value instanceof ArrayBuffer) {
				toc.push({
					t: 'b',
					l: value.byteLength
				})

				length += value.byteLength
			}
 		}

		var jsonified = JSON.stringify(toc)

		length += jsonified.length + Uint32Array.BYTES_PER_ELEMENT + 1

		var writer = new BinaryWriter(length)

		writer.setUint8(BinaryWriter.validationByte) // validation byte
		writer.setUint32(jsonified.length) // table of contents length
		writer.setString(jsonified) // ToC

		for (var i = 0; i < toc.length; i++) {
			switch(toc[i].t) {
				case 's': writer.setString(contents[i]); break
				case 't': writer.setTypedArray(contents[i]); break
				case 'b': writer.setBuffer(contents[i]); break
			}
		}

		if (!writer.isAtEnd()) {
			throw "The lengths don't match up";
		}

		return writer.raw
	}
Returns array buffer, which contains the binary data.
@param  {array} contents
@return {ArrayBuffer}