internal static Stream CreateStream(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyWriteConfiguration writerConfiguration = new BodyWriteConfiguration(configuration);

            provider = BodyWriteDelegates.CreateConversionDelegateProvider(coreItem, writerConfiguration);
            return(ConvertUtils.CallCtsWithReturnValue <Stream>(ExTraceGlobals.CcBodyTracer, "BodyWriteDelegates::CreateStream", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyWriteDelegates.ConversionCreator conversionMethod = BodyWriteDelegates.GetConversionMethod(configuration);
                return (Stream)conversionMethod(coreItem, writerConfiguration, bodyStream, false);
            }));
        }
        internal static TextWriter CreateWriter(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyWriteConfiguration writerConfiguration = new BodyWriteConfiguration(configuration);

            writerConfiguration.SourceCharset = ConvertUtils.UnicodeCharset;
            provider = BodyWriteDelegates.CreateConversionDelegateProvider(coreItem, writerConfiguration);
            return(ConvertUtils.CallCtsWithReturnValue <TextWriter>(ExTraceGlobals.CcBodyTracer, "BodyWriteDelegates::CreateWriter", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyWriteDelegates.ConversionCreator conversionMethod = BodyWriteDelegates.GetConversionMethod(writerConfiguration);
                return (TextWriter)conversionMethod(coreItem, writerConfiguration, bodyStream, true);
            }));
        }