예제 #1
0
 /// <summary>
 /// Converts the entire XML <see cref="Stream"/> object from the resolved encoding of <paramref name="source"/> to the specified encoding.
 /// If an encoding cannot be resolved from <paramref name="source"/>, UTF-8 encoding is assumed.
 /// </summary>
 /// <param name="source">The <see cref="Stream"/> to apply the conversion to.</param>
 /// <param name="targetEncoding">The target encoding format.</param>
 /// <param name="omitXmlDeclaration">if set to <c>true</c> omit the XML declaration; otherwise <c>false</c>. The default is false.</param>
 /// <returns>A <see cref="Stream"/> object containing the results of converting bytes from the resolved source encoding to the specified targetEncoding.</returns>
 public static Stream ChangeEncoding(Stream source, Encoding targetEncoding, bool omitXmlDeclaration)
 {
     return(ChangeEncoding(source, XmlEncodingUtility.ReadEncoding(source), targetEncoding, PreambleSequence.Keep, omitXmlDeclaration));
 }
예제 #2
0
 /// <summary>
 /// Converts the entire XML <see cref="Stream"/> object from the resolved encoding of <paramref name="source"/> to the specified encoding.
 /// If an encoding cannot be resolved from <paramref name="source"/>, UTF-8 encoding is assumed.
 /// </summary>
 /// <param name="source">The <see cref="Stream"/> to apply the conversion to.</param>
 /// <param name="targetEncoding">The target encoding format.</param>
 /// <param name="sequence">Determines whether too keep or remove any preamble sequences.</param>
 /// <returns>A <see cref="Stream"/> object containing the results of converting bytes from the resolved source encoding to the specified targetEncoding.</returns>
 public static Stream ChangeEncoding(Stream source, Encoding targetEncoding, PreambleSequence sequence)
 {
     return(ChangeEncoding(source, XmlEncodingUtility.ReadEncoding(source), targetEncoding, sequence));
 }