public void Encode(Stream outputStream) { outputStream.WriteByte(EncodingMask); if ((EncodingMask & 0x01) == 1) { byte[] localeBytes = Locale.Encode(); outputStream.Write(localeBytes, 0, localeBytes.Length); } if ((EncodingMask & 0x02) == 2) { byte[] textBytes = Text.Encode(); outputStream.Write(textBytes, 0, textBytes.Length); } }