internal static TextReader CreateReader(ICoreItem coreItem, BodyReadConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyReadConfiguration readerConfiguration = new BodyReadConfiguration(configuration);

            readerConfiguration.Charset = ConvertUtils.UnicodeCharset;
            provider = BodyReadDelegates.CreateConversionDelegateProvider(coreItem, readerConfiguration);
            return(ConvertUtils.CallCtsWithReturnValue <TextReader>(ExTraceGlobals.CcBodyTracer, "BodyReadDelegates::CreateReader", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyReadDelegates.ConversionCreator conversionMethod = BodyReadDelegates.GetConversionMethod(coreItem, configuration);
                return (TextReader)conversionMethod(coreItem, readerConfiguration, bodyStream, true);
            }));
        }
        internal static Stream CreateStream(ICoreItem coreItem, BodyReadConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyReadConfiguration readConfiguration = new BodyReadConfiguration(configuration);

            provider = BodyReadDelegates.CreateConversionDelegateProvider(coreItem, readConfiguration);
            if (readConfiguration.Charset == null)
            {
                readConfiguration.Charset = ConvertUtils.GetItemMimeCharset(coreItem.PropertyBag);
            }
            if (!readConfiguration.IsBodyTransformationNeeded(coreItem.Body))
            {
                return(bodyStream);
            }
            return(ConvertUtils.CallCtsWithReturnValue <Stream>(ExTraceGlobals.CcBodyTracer, "BodyReadDelegates::CreateStream", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyReadDelegates.ConversionCreator conversionMethod = BodyReadDelegates.GetConversionMethod(coreItem, configuration);
                return (Stream)conversionMethod(coreItem, readConfiguration, bodyStream, false);
            }));
        }