private void writeFields(final DataOutputStream out, final Set onlyFields)
			throws IOException {
		out.writeShort(fields.length);

		for (int i = 0; i < fields.length; i++) {
			if ((onlyFields != null) && onlyFields.contains(fields[i])) {
				continue;
			}
			fields[i].write(out);
		}
	}