Ejemplo n.º 1
0
 /// <summary>
 /// Constructs a new OutputStreamWriter using
 /// <code>out</code>
 /// as the target
 /// stream to write converted characters to and
 /// <code>enc</code>
 /// as the character
 /// encoder.
 /// </summary>
 /// <param name="out">the target stream to write converted bytes to.</param>
 /// <param name="enc">the character encoder used for character conversion.</param>
 public OutputStreamWriter(java.io.OutputStream @out, java.nio.charset.CharsetEncoder
                           enc) : base(@out)
 {
     enc.charset();
     this.@out = @out;
     encoder   = enc;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs a new OutputStreamWriter using
 /// <code>out</code>
 /// as the target
 /// stream to write converted characters to and
 /// <code>cs</code>
 /// as the character
 /// encoding.
 /// </summary>
 /// <param name="out">the target stream to write converted bytes to.</param>
 /// <param name="cs">
 /// the
 /// <code>Charset</code>
 /// that specifies the character encoding.
 /// </param>
 public OutputStreamWriter(java.io.OutputStream @out, java.nio.charset.Charset cs)
     : base(@out)
 {
     this.@out = @out;
     encoder   = cs.newEncoder();
     encoder.onMalformedInput(java.nio.charset.CodingErrorAction.REPLACE);
     encoder.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPLACE);
 }
Ejemplo n.º 3
0
 public override void close()
 {
     lock (@lock)
     {
         if (encoder != null)
         {
             drainEncoder();
             flushBytes(false);
             @out.close();
             encoder = null;
             bytes   = null;
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructs a new OutputStreamWriter using
 /// <code>out</code>
 /// as the target
 /// stream to write converted characters to and
 /// <code>enc</code>
 /// as the character
 /// encoding. If the encoding cannot be found, an
 /// UnsupportedEncodingException error is thrown.
 /// </summary>
 /// <param name="out">the target stream to write converted bytes to.</param>
 /// <param name="enc">the string describing the desired character encoding.</param>
 /// <exception cref="System.ArgumentNullException">
 /// if
 /// <code>enc</code>
 /// is
 /// <code>null</code>
 /// .
 /// </exception>
 /// <exception cref="UnsupportedEncodingException">
 /// if the encoding specified by
 /// <code>enc</code>
 /// cannot be found.
 /// </exception>
 /// <exception cref="java.io.UnsupportedEncodingException"></exception>
 public OutputStreamWriter(java.io.OutputStream @out, string enc) : base(@out)
 {
     if (enc == null)
     {
         throw new System.ArgumentNullException();
     }
     this.@out = @out;
     try
     {
         encoder = java.nio.charset.Charset.forName(enc).newEncoder();
     }
     catch (System.Exception)
     {
         throw new java.io.UnsupportedEncodingException(enc);
     }
     encoder.onMalformedInput(java.nio.charset.CodingErrorAction.REPLACE);
     encoder.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPLACE);
 }
Ejemplo n.º 5
0
		/// <summary>
		/// Constructs a new OutputStreamWriter using
		/// <code>out</code>
		/// as the target
		/// stream to write converted characters to and
		/// <code>enc</code>
		/// as the character
		/// encoding. If the encoding cannot be found, an
		/// UnsupportedEncodingException error is thrown.
		/// </summary>
		/// <param name="out">the target stream to write converted bytes to.</param>
		/// <param name="enc">the string describing the desired character encoding.</param>
		/// <exception cref="System.ArgumentNullException">
		/// if
		/// <code>enc</code>
		/// is
		/// <code>null</code>
		/// .
		/// </exception>
		/// <exception cref="UnsupportedEncodingException">
		/// if the encoding specified by
		/// <code>enc</code>
		/// cannot be found.
		/// </exception>
		/// <exception cref="java.io.UnsupportedEncodingException"></exception>
		public OutputStreamWriter(java.io.OutputStream @out, string enc) : base(@out)
		{
			if (enc == null)
			{
				throw new System.ArgumentNullException();
			}
			this.@out = @out;
			try
			{
				encoder = java.nio.charset.Charset.forName(enc).newEncoder();
			}
			catch (System.Exception)
			{
				throw new java.io.UnsupportedEncodingException(enc);
			}
			encoder.onMalformedInput(java.nio.charset.CodingErrorAction.REPLACE);
			encoder.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPLACE);
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Constructs a new OutputStreamWriter using
		/// <code>out</code>
		/// as the target
		/// stream to write converted characters to and
		/// <code>cs</code>
		/// as the character
		/// encoding.
		/// </summary>
		/// <param name="out">the target stream to write converted bytes to.</param>
		/// <param name="cs">
		/// the
		/// <code>Charset</code>
		/// that specifies the character encoding.
		/// </param>
		public OutputStreamWriter(java.io.OutputStream @out, java.nio.charset.Charset cs)
			 : base(@out)
		{
			this.@out = @out;
			encoder = cs.newEncoder();
			encoder.onMalformedInput(java.nio.charset.CodingErrorAction.REPLACE);
			encoder.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPLACE);
		}
Ejemplo n.º 7
0
		public override void close()
		{
			lock (@lock)
			{
				if (encoder != null)
				{
					drainEncoder();
					flushBytes(false);
					@out.close();
					encoder = null;
					bytes = null;
				}
			}
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Constructs a new OutputStreamWriter using
		/// <code>out</code>
		/// as the target
		/// stream to write converted characters to and
		/// <code>enc</code>
		/// as the character
		/// encoder.
		/// </summary>
		/// <param name="out">the target stream to write converted bytes to.</param>
		/// <param name="enc">the character encoder used for character conversion.</param>
		public OutputStreamWriter(java.io.OutputStream @out, java.nio.charset.CharsetEncoder
			 enc) : base(@out)
		{
			enc.charset();
			this.@out = @out;
			encoder = enc;
		}