Code example for BackupDataOutput

Methods: writeEntityDatawriteEntityHeader

			// Okay, we've flattened the data for transmission.  Pull it 
			// out of the buffering stream object and send it off. 
			byte[] buffer = bufStream.toByteArray();
			int len = buffer.length;
			data.writeEntityHeader(APP_DATA_KEY, len);
			data.writeEntityData(buffer, len);
		//record a newState 
	public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
		while (data.readNextHeader()) {
			String key = data.getKey();
			int dataSize = data.getDataSize();
			if (APP_DATA_KEY.equals(key)) {
				byte[] dataBuf = new byte[dataSize];
				data.readEntityData(dataBuf, 0, dataSize);