Example #1
0
        /// <summary>
        /// Releases the unmanaged resources used by this
        /// <see cref="T:System.IO.TextWriter"/>
        /// and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        /// <c>true</c> to release both managed and unmanaged resources;
        /// <c>false</c> to release only unmanaged resources.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this)
                {
                    try
                    {
                        if (m_writer != null)
                        {
                            m_writer.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        throw new IOException(ex.toString(), ex);
                    }
                    finally
                    {
                        m_writer = null;

                        base.Dispose(disposing);
                    }
                }
            }
            else
            {
                base.Dispose(disposing);
            }
        }
Example #2
0
 /// <summary>
 /// Writes the contents of this
 /// <code>CharArrayWriter</code>
 /// to another
 /// <code>Writer</code>
 /// . The output is all the characters that have been written to the
 /// receiver since the last reset or since it was created.
 /// </summary>
 /// <param name="out">
 /// the non-null
 /// <code>Writer</code>
 /// on which to write the contents.
 /// </param>
 /// <exception cref="System.ArgumentNullException">
 /// if
 /// <code>out</code>
 /// is
 /// <code>null</code>
 /// .
 /// </exception>
 /// <exception cref="IOException">if an error occurs attempting to write out the contents.
 ///     </exception>
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void writeTo(java.io.Writer @out)
 {
     lock (@lock)
     {
         @out.write(buf, 0, count);
     }
 }
Example #3
0
		/// <summary>
		/// Constructs a new
		/// <code>BufferedWriter</code>
		/// , providing
		/// <code>out</code>
		/// with
		/// <code>size</code>
		/// bytes
		/// of buffer.
		/// </summary>
		/// <param name="out">
		/// the
		/// <code>OutputStream</code>
		/// the buffer writes to.
		/// </param>
		/// <param name="size">the size of buffer in bytes.</param>
		/// <exception cref="System.ArgumentException">
		/// if
		/// <code>size &lt;= 0</code>
		/// .
		/// </exception>
		public BufferedWriter(java.io.Writer @out, int size) : base(@out)
		{
			if (size <= 0)
			{
				throw new System.ArgumentException("size <= 0");
			}
			this.@out = @out;
			this.buf = new char[size];
		}
Example #4
0
        public JavaWriterWrapper(java.io.Writer writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            m_writer = writer;
        }
Example #5
0
 /// <summary>
 /// Constructs a new
 /// <code>BufferedWriter</code>
 /// , providing
 /// <code>out</code>
 /// with
 /// <code>size</code>
 /// bytes
 /// of buffer.
 /// </summary>
 /// <param name="out">
 /// the
 /// <code>OutputStream</code>
 /// the buffer writes to.
 /// </param>
 /// <param name="size">the size of buffer in bytes.</param>
 /// <exception cref="System.ArgumentException">
 /// if
 /// <code>size &lt;= 0</code>
 /// .
 /// </exception>
 public BufferedWriter(java.io.Writer @out, int size) : base(@out)
 {
     if (size <= 0)
     {
         throw new System.ArgumentException("size <= 0");
     }
     this.@out = @out;
     this.buf  = new char[size];
 }
        public JavaWriterWrapper(java.io.Writer writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            m_writer = writer;
        }
Example #7
0
 internal override bool checkError()
 {
     java.io.Writer @delegate = @out;
     if (@delegate == null)
     {
         return(ioError);
     }
     flush();
     return(ioError || @delegate.checkError());
 }
        internal void SendResponseFromMemory(char [] data, int offset, int length, Encoding encoding)
        {
            java.io.Writer writer = GetOutputWriter(encoding);
            if (writer == null)             //if was redirected - silently returns null
            {
                return;
            }

            writer.write(data, offset, length);
        }
Example #9
0
 public virtual void store(java.io.Writer arg0, java.lang.String arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.util.Properties._store15611, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.util.Properties.staticClass, global::java.util.Properties._store15611, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
Example #10
0
 void org.xmlpull.v1.XmlSerializer.setOutput(java.io.Writer arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::org.xmlpull.v1.XmlSerializer_._setOutput16607, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::org.xmlpull.v1.XmlSerializer_.staticClass, global::org.xmlpull.v1.XmlSerializer_._setOutput16607, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
 }
Example #11
0
 public override void close()
 {
     lock (@lock)
     {
         if (@out != null)
         {
             try
             {
                 @out.close();
             }
             catch (System.IO.IOException)
             {
                 setError();
             }
             @out = null;
         }
     }
 }
Example #12
0
 public override void close()
 {
     lock (@lock)
     {
         if (isClosed())
         {
             return;
         }
         System.Exception thrown = null;
         try
         {
             flushInternal();
         }
         catch (System.Exception e)
         {
             thrown = e;
         }
         buf = null;
         try
         {
             @out.close();
         }
         catch (System.Exception e)
         {
             if (thrown == null)
             {
                 thrown = e;
             }
         }
         @out = null;
         if (thrown != null)
         {
             Sharpen.Util.Throw(thrown);
         }
     }
 }
Example #13
0
 public PrintWriter(java.io.Writer arg0)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.io.PrintWriter.staticClass, global::java.io.PrintWriter._PrintWriter12702, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
Example #14
0
 /// <summary>
 /// Constructs a new
 /// <code>BufferedWriter</code>
 /// , providing
 /// <code>out</code>
 /// with a buffer
 /// of 8192 bytes.
 /// </summary>
 /// <param name="out">
 /// the
 /// <code>Writer</code>
 /// the buffer writes to.
 /// </param>
 public BufferedWriter(java.io.Writer @out) : this(@out, 8192)
 {
 }
Example #15
0
		public override void close()
		{
			lock (@lock)
			{
				if (isClosed())
				{
					return;
				}
				System.Exception thrown = null;
				try
				{
					flushInternal();
				}
				catch (System.Exception e)
				{
					thrown = e;
				}
				buf = null;
				try
				{
					@out.close();
				}
				catch (System.Exception e)
				{
					if (thrown == null)
					{
						thrown = e;
					}
				}
				@out = null;
				if (thrown != null)
				{
					Sharpen.Util.Throw(thrown);
				}
			}
		}
Example #16
0
 static JavaWriterWrapper NewTestSubject(java.io.Writer writer)
 {
     return(new JavaWriterWrapper(writer));
 }
Example #17
0
		/// <summary>
		/// Constructs a new FilterWriter on the Writer
		/// <code>out</code>
		/// . All writes are
		/// now filtered through this writer.
		/// </summary>
		/// <param name="out">the target Writer to filter writes on.</param>
		protected internal FilterWriter(java.io.Writer @out) : base(@out)
		{
			this.@out = @out;
		}
Example #18
0
 public PrintWriterAnonymousInnerClassHelper(Console outerInstance, java.io.Writer @out) : base(@out, true)
 {
     this.OuterInstance = outerInstance;
 }
Example #19
0
		/// <summary>
		/// Constructs a new
		/// <code>PrintWriter</code>
		/// with
		/// <code>out</code>
		/// as its target
		/// writer. The parameter
		/// <code>autoFlush</code>
		/// determines if the print writer
		/// automatically flushes its contents to the target writer when a newline is
		/// encountered.
		/// </summary>
		/// <param name="wr">the target writer.</param>
		/// <param name="autoFlush">
		/// indicates whether to flush contents upon encountering a
		/// newline sequence.
		/// </param>
		/// <exception cref="System.ArgumentNullException">
		/// if
		/// <code>out</code>
		/// is
		/// <code>null</code>
		/// .
		/// </exception>
		public PrintWriter(java.io.Writer wr, bool autoFlush) : base(wr)
		{
			this.autoFlush = autoFlush;
			@out = wr;
		}
Example #20
0
        public static List <String> rewrite(java.io.Reader content, Uri source,
                                            ILinkRewriter rewriter, java.io.Writer writer, bool extractImports)
        {
            List <String> imports  = new List <string>();
            CharProducer  producer = CharProducer.Factory.create(content,
                                                                 new InputSource(new java.net.URI(source.ToString())));
            CssLexer lexer = new CssLexer(producer);

            try
            {
                bool inImport = false;
                while (lexer.hasNext())
                {
                    Token token = lexer.next();
                    if (extractImports)
                    {
                        if (token.type == CssTokenType.SYMBOL && token.text.ToLower().Equals("@import"))
                        {
                            inImport = true;
                            continue;
                        }
                        if (inImport)
                        {
                            if (token.type == CssTokenType.URI)
                            {
                                Match matcher = urlMatcher.Match(token.text);
                                if (matcher.Success)
                                {
                                    imports.Add(matcher.Groups[2].Value.Trim());
                                }
                            }
                            else if (token.type != CssTokenType.SPACE && token.type != CssTokenType.PUNCTUATION)
                            {
                                inImport = false;
                            }
                        }
                        if (!inImport)
                        {
                            writer.write(token.text);
                        }
                    }
                    else
                    {
                        if (token.type == CssTokenType.URI)
                        {
                            writer.write(rewriteLink(token, source, rewriter));
                            continue;
                        }
                        writer.write(token.text);
                    }
                }
                writer.flush();
            }
            catch (ParseException pe)
            {
                pe.printStackTrace();
            }
            catch (Exception ioe)
            {
                throw ioe;
            }
            return(imports);
        }
        /// <summary>Specify the destination of the serialized output, in the
        /// form of a <c>TextWriter</c></summary>
        /// <remarks>Note that when writing to a <c>TextWriter</c>, character encoding is
        /// the responsibility of the <c>TextWriter</c>, not the <c>Serializer</c>. This
        /// means that the encoding requested in the output properties is ignored; it also
        /// means that characters that cannot be represented in the target encoding will
        /// use whatever fallback representation the <c>TextWriter</c> defines, rather than
        /// being represented as XML character references.</remarks>
        /// <param name="textWriter">The stream to which the output will be written.
        /// This must be a stream that allows writing.</param>

        public void SetOutputWriter(TextWriter textWriter) {
            writer = new DotNetWriter(textWriter);
            mustClose = false;
        }
Example #22
0
 /// <summary>
 /// Constructs a new
 /// <code>PrintWriter</code>
 /// with
 /// <code>wr</code>
 /// as its target
 /// writer. By default, the new print writer does not automatically flush its
 /// contents to the target writer when a newline is encountered.
 /// </summary>
 /// <param name="wr">the target writer.</param>
 /// <exception cref="System.ArgumentNullException">
 /// if
 /// <code>wr</code>
 /// is
 /// <code>null</code>
 /// .
 /// </exception>
 public PrintWriter(java.io.Writer wr) : this(wr, false)
 {
 }
Example #23
0
 /// <summary>
 /// Constructs a new
 /// <code>PrintWriter</code>
 /// with
 /// <code>out</code>
 /// as its target
 /// writer. The parameter
 /// <code>autoFlush</code>
 /// determines if the print writer
 /// automatically flushes its contents to the target writer when a newline is
 /// encountered.
 /// </summary>
 /// <param name="wr">the target writer.</param>
 /// <param name="autoFlush">
 /// indicates whether to flush contents upon encountering a
 /// newline sequence.
 /// </param>
 /// <exception cref="System.ArgumentNullException">
 /// if
 /// <code>out</code>
 /// is
 /// <code>null</code>
 /// .
 /// </exception>
 public PrintWriter(java.io.Writer wr, bool autoFlush) : base(wr)
 {
     this.autoFlush = autoFlush;
     @out           = wr;
 }
Example #24
0
        public static void rewrite(java.io.Reader content, Uri source,
                                   Dictionary <String, IHtmlTagTransformer> transformers, java.io.Writer writer)
        {
            CharProducer producer = CharProducer.Factory.create(content, new InputSource(new java.net.URI(source.ToString())));
            HtmlLexer    lexer    = new HtmlLexer(producer);

            try
            {
                Token lastToken  = null;
                Token currentTag = null;
                IHtmlTagTransformer currentTransformer = null;
                bool tagChanged;
                while (lexer.hasNext())
                {
                    tagChanged = false;
                    Token token = lexer.next() as Token;
                    if (token.type == HtmlTokenType.IGNORABLE)
                    {
                        continue;
                    }
                    if (token.type == HtmlTokenType.TAGBEGIN)
                    {
                        currentTag = token;
                        tagChanged = true;
                    }
                    if (tagChanged)
                    {
                        if (currentTransformer == null)
                        {
                            transformers.TryGetValue(currentTag.toString().Substring(1).ToLower(), out currentTransformer);
                        }
                        else
                        {
                            if (!currentTransformer.acceptNextTag(currentTag))
                            {
                                writer.write(currentTransformer.close());
                                transformers.TryGetValue(currentTag.toString().Substring(1).ToLower(), out currentTransformer);
                            }
                        }
                    }
                    if (currentTransformer == null)
                    {
                        writer.write(producePreTokenSeparator(token, lastToken));
                        writer.write(token.toString());
                        writer.write(producePostTokenSeparator(token, lastToken));
                    }
                    else
                    {
                        currentTransformer.accept(token, lastToken);
                    }
                    if (token.type == HtmlTokenType.TAGEND)
                    {
                        currentTag = null;
                    }
                    lastToken = token;
                }
                if (currentTransformer != null)
                {
                    writer.write(currentTransformer.close());
                }
                writer.flush();
            }
            catch (Exception pe)
            {
                throw pe;
            }
        }
Example #25
0
 /// <summary>
 /// Constructs a new FilterWriter on the Writer
 /// <code>out</code>
 /// . All writes are
 /// now filtered through this writer.
 /// </summary>
 /// <param name="out">the target Writer to filter writes on.</param>
 protected internal FilterWriter(java.io.Writer @out) : base(@out)
 {
     this.@out = @out;
 }
Example #26
0
		public virtual void setOutput(java.io.Writer writer)
		{
			mWriter = writer;
		}
Example #27
0
		public override void close()
		{
			lock (@lock)
			{
				if (@out != null)
				{
					try
					{
						@out.close();
					}
					catch (System.IO.IOException)
					{
						setError();
					}
					@out = null;
				}
			}
		}
        /// <summary>
        /// Releases the unmanaged resources used by this
        /// <see cref="T:System.IO.TextWriter"/>
        /// and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        /// <c>true</c> to release both managed and unmanaged resources;
        /// <c>false</c> to release only unmanaged resources.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this)
                {
                    try
                    {
                        if (m_writer != null)
                        {
                            m_writer.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        throw new IOException(ex.toString(), ex);
                    }
                    finally
                    {
                        m_writer = null;

                        base.Dispose(disposing);
                    }
                }
            }
            else
            {
                base.Dispose(disposing);
            }
        }
Example #29
0
 public void writeValue(java.io.Writer writer, object obj)
 {
     throw new NotImplementedException();
 }
Example #30
0
        /// <summary>Specify the destination of the serialized output, in the
        /// form of a <c>TextWriter</c></summary>
        /// <remarks>Note that when writing to a <c>TextWriter</c>, character encoding is
        /// the responsibility of the <c>TextWriter</c>, not the <c>Serializer</c>. This
        /// means that the encoding requested in the output properties is ignored; it also
        /// means that characters that cannot be represented in the target encoding will
        /// use whatever fallback representation the <c>TextWriter</c> defines, rather than
        /// being represented as XML character references.</remarks>
        /// <param name="textWriter">The stream to which the output will be written.
        /// This must be a stream that allows writing. Saxon will not close the
        /// <c>textWriter</c> on completion; this is the caller's responsibility.</param>

        public void SetOutputWriter(TextWriter textWriter)
        {
            writer    = new JDotNetWriter(textWriter);
            mustClose = false;
        }
Example #31
0
 public Model write(java.io.Writer w, string str)
 {
     throw new NotImplementedException();
 }
Example #32
0
 public virtual void setOutput(java.io.Writer writer)
 {
     mWriter = writer;
 }
Example #33
0
 public static global::javax.microedition.khronos.egl.EGL wrap(javax.microedition.khronos.egl.EGL arg0, int arg1, java.io.Writer arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     return(global::MonoJavaBridge.JavaBridge.WrapIJavaObject <global::javax.microedition.khronos.egl.EGL>(@__env.CallStaticObjectMethod(android.opengl.GLDebugHelper.staticClass, global::android.opengl.GLDebugHelper._wrap5549, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))) as javax.microedition.khronos.egl.EGL);
 }