public static void StreamToMQMessage(Stream stream, IBM.WMQ.MQMessage msg) { stream.Seek(0, SeekOrigin.Begin); byte[] buffer = new byte[100 * 1024]; int read = stream.Read(buffer, 0, buffer.Length); while (read > 0) { msg.Write(buffer, 0, read); read = stream.Read(buffer, 0, buffer.Length); } }