private static void writeDataPacket(Stream stream, DataPacket dataPacket) { if (stream != null) { dataPacket.WriteDelimitedTo(stream); } }