getHead() public méthode

public getHead ( java arg0 ) : global::java.lang.String
arg0 java
Résultat global::java.lang.String
Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private synchronized void flushAndClose() throws SecurityException
        private void FlushAndClose()
        {
            lock (this)
            {
                CheckPermission();
                if (Writer != null)
                {
                    try
                    {
                        if (!DoneHeader)
                        {
                            Writer.Write(Formatter.getHead(this));
                            DoneHeader = true;
                        }
                        Writer.Write(Formatter.getTail(this));
                        Writer.Flush();
                        Writer.Close();
                    }
                    catch (Exception ex)
                    {
                        // We don't want to throw an exception here, but we
                        // report the exception to any registered ErrorManager.
                        ReportError(null, ex, ErrorManager.CLOSE_FAILURE);
                    }
                    Writer = null;
                    Output = null;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Format and publish a <tt>LogRecord</tt>.
        /// <para>
        /// The <tt>StreamHandler</tt> first checks if there is an <tt>OutputStream</tt>
        /// and if the given <tt>LogRecord</tt> has at least the required log level.
        /// If not it silently returns.  If so, it calls any associated
        /// <tt>Filter</tt> to check if the record should be published.  If so,
        /// it calls its <tt>Formatter</tt> to format the record and then writes
        /// the result to the current output stream.
        /// </para>
        /// <para>
        /// If this is the first <tt>LogRecord</tt> to be written to a given
        /// <tt>OutputStream</tt>, the <tt>Formatter</tt>'s "head" string is
        /// written to the stream before the <tt>LogRecord</tt> is written.
        ///
        /// </para>
        /// </summary>
        /// <param name="record">  description of the log event. A null record is
        ///                 silently ignored and is not published </param>
        public override void Publish(LogRecord record)
        {
            lock (this)
            {
                if (!IsLoggable(record))
                {
                    return;
                }
                String msg;
                try
                {
                    msg = Formatter.format(record);
                }
                catch (Exception ex)
                {
                    // We don't want to throw an exception here, but we
                    // report the exception to any registered ErrorManager.
                    ReportError(null, ex, ErrorManager.FORMAT_FAILURE);
                    return;
                }

                try
                {
                    if (!DoneHeader)
                    {
                        Writer.Write(Formatter.getHead(this));
                        DoneHeader = true;
                    }
                    Writer.Write(msg);
                }
                catch (Exception ex)
                {
                    // We don't want to throw an exception here, but we
                    // report the exception to any registered ErrorManager.
                    ReportError(null, ex, ErrorManager.WRITE_FAILURE);
                }
            }
        }