memoryhandler.html
来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 475 行 · 第 1/2 页
HTML
475 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_03) on Wed Nov 02 09:52:11 CST 2005 --><META http-equiv="Content-Type" content="text/html; charset=gb2312"><TITLE>MemoryHandler (Java 2 Platform SE 5.0)</TITLE><META NAME="keywords" CONTENT="java.util.logging.MemoryHandler class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="MemoryHandler (Java 2 Platform SE 5.0)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="跳过导航链接"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>类</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MemoryHandler.html"><FONT CLASS="NavBarFont1"><B>使用</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Standard Ed. 5.0</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="LogRecord.html" title="java.util.logging 中的类"><B>上一个类</B></A> <A HREF="SimpleFormatter.html" title="java.util.logging 中的类"><B>下一个类</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html@java_2Futil_2Flogging_2FMemoryHandler.html" target="_top"><B>框架</B></A> <A HREF="MemoryHandler.html" target="_top"><B>无框架</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>所有类</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 摘要: 嵌套 | 字段 | <A HREF="#constructor_summary">构造方法</A> | <A HREF="#method_summary">方法</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">详细信息: 字段 | <A HREF="#constructor_detail">构造方法</A> | <A HREF="#method_detail">方法</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.util.logging</FONT><BR>类 MemoryHandler</H2><PRE><A HREF="../../lang/Object.html" title="java.lang 中的类">java.lang.Object</A> <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><A HREF="Handler.html" title="java.util.logging 中的类">java.util.logging.Handler</A> <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><B>java.util.logging.MemoryHandler</B></PRE><HR><DL><DT><PRE>public class <B>MemoryHandler</B><DT>extends <A HREF="Handler.html" title="java.util.logging 中的类">Handler</A></DL></PRE><P><tt>Handler</tt> 在内存中的循环缓冲区中对请求进行缓冲处理。 <p>通常,此 <tt>Handler</tt> 只将传入的 <tt>LogRecords</tt> 存储到内存缓冲区,并丢弃原来的记录。此缓冲非常经济,并且避免了格式化开销。在一定的触发条件下,<tt>MemoryHandler</tt> 将其当前的缓冲区内容 push 到目标 <tt>Handler</tt> 中,此 Handler 通常将内容发布到外界。 <p>有三种主要模型用于触发缓冲区的 push 操作: <ul> <li>传入的 <tt>LogRecord</tt> 类型大于预先定义的 <tt>pushLevel</tt> 级别。 <li>外部类显式地调用 <tt>push</tt> 方法。 <li>如果记录符合所需的某些标准,则子类重写 <tt>log</tt> 方法,并扫描每个传入的 <tt>LogRecord</tt>,调用 <tt>push</tt>。 </ul> <p><b>配置:</b>默认情况下,使用以下 LogManager 配置属性初始化每个 <tt>MemoryHandler</tt>。如果没有定义该属性(或者有无效的值),则使用指定的默认值。如果没有定义默认值,则抛出 RuntimeException。 <ul><li> java.util.logging.MemoryHandler.level 指定 <tt>Handler</tt> 的级别(默认为 <tt>Level.ALL</tt>)。<li> java.util.logging.MemoryHandler.filter 指定要使用的 <tt>Filter</tt> 类的名称(默认为无 <tt>Filter</tt>)。<li> java.util.logging.MemoryHandler.size 定义缓冲区的大小(默认为 1000)。<li> java.util.logging.MemoryHandler.push 定义 <tt>pushLevel</tt>(默认为 <tt>level.SEVERE</tt>)。 <li> java.util.logging.MemoryHandler.target 指定目标 <tt>Handler</tt> 类的名称(无默认值)。 </ul><P><P><DL><DT><B>从以下版本开始:</B></DT> <DD>1.4</DD></DL><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>构造方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="MemoryHandler.html#MemoryHandler()">MemoryHandler</A></B>()</CODE><BR> 根据 <tt>LogManager</tt> 配置属性创建一个 <tt>MemoryHandler</tt>,并对其进行配置。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="MemoryHandler.html#MemoryHandler(java.util.logging.Handler, int, java.util.logging.Level)">MemoryHandler</A></B>(<A HREF="Handler.html" title="java.util.logging 中的类">Handler</A> target, int size, <A HREF="Level.html" title="java.util.logging 中的类">Level</A> pushLevel)</CODE><BR> 创建一个 <tt>MemoryHandler</tt>。</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#close()">close</A></B>()</CODE><BR> 关闭 <tt>Handler</tt>,并释放所有相关的资源。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#flush()">flush</A></B>()</CODE><BR> 导致目标 <tt>Handler</tt> 上的刷新。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Level.html" title="java.util.logging 中的类">Level</A></CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#getPushLevel()">getPushLevel</A></B>()</CODE><BR> 获得 <tt>pushLevel</tt>。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#isLoggable(java.util.logging.LogRecord)">isLoggable</A></B>(<A HREF="LogRecord.html" title="java.util.logging 中的类">LogRecord</A> record)</CODE><BR> 检查此 <tt>Handler</tt> 是否实际将给定的 <tt>LogRecord</tt> 记录到其内部缓冲区。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#publish(java.util.logging.LogRecord)">publish</A></B>(<A HREF="LogRecord.html" title="java.util.logging 中的类">LogRecord</A> record)</CODE><BR> 将 <tt>LogRecord</tt> 存储在内部缓冲区。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#push()">push</A></B>()</CODE><BR> 将所有已缓冲的输出 push 到目标 <tt>Handler</tt> 中。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="MemoryHandler.html#setPushLevel(java.util.logging.Level)">setPushLevel</A></B>(<A HREF="Level.html" title="java.util.logging 中的类">Level</A> newLevel)</CODE><BR> 设置 <tt>pushLevel</tt>。</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.util.logging.Handler"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.util.logging.<A HREF="Handler.html" title="java.util.logging 中的类">Handler</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="Handler.html#getEncoding()">getEncoding</A>, <A HREF="Handler.html#getErrorManager()">getErrorManager</A>, <A HREF="Handler.html#getFilter()">getFilter</A>, <A HREF="Handler.html#getFormatter()">getFormatter</A>, <A HREF="Handler.html#getLevel()">getLevel</A>, <A HREF="Handler.html#reportError(java.lang.String, java.lang.Exception, int)">reportError</A>, <A HREF="Handler.html#setEncoding(java.lang.String)">setEncoding</A>, <A HREF="Handler.html#setErrorManager(java.util.logging.ErrorManager)">setErrorManager</A>, <A HREF="Handler.html#setFilter(java.util.logging.Filter)">setFilter</A>, <A HREF="Handler.html#setFormatter(java.util.logging.Formatter)">setFormatter</A>, <A HREF="Handler.html#setLevel(java.util.logging.Level)">setLevel</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.lang.<A HREF="../../lang/Object.html" title="java.lang 中的类">Object</A> 继承的方法</B></TH></TR>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?