📄 debugcallbackdecorator.java
字号:
package it.unimi.dsi.mg4j.util.parser.callback;/* * MG4J: Managing Gigabytes for Java * * Copyright (C) 2005-2007 Sebastiano Vigna * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */import it.unimi.dsi.mg4j.util.MutableString;import it.unimi.dsi.mg4j.util.parser.Attribute;import it.unimi.dsi.mg4j.util.parser.BulletParser;import it.unimi.dsi.mg4j.util.parser.Element;import java.util.Map;/** A decorator that prints on standard error all calls to the underlying callback. * @deprecated Moved to <code>dsiutils</code>. */@Deprecatedpublic class DebugCallbackDecorator implements Callback { /** The underlying callback. */ private final Callback callback; public DebugCallbackDecorator( final Callback callback ) { this.callback = callback; } public boolean cdata( final Element element, final char[] text, final int offset, final int length ) { System.err.println( "cdata(" + new String( text, offset, length ) + ")" ); return callback.cdata( element, text, offset, length ); } public boolean characters( final char[] text, final int offset, final int length, final boolean flowBroken ) { System.err.println( "characters(" + new String( text, offset, length ) + ", " + flowBroken + ")" ); return callback.characters( text, offset, length, flowBroken ); } public void configure( final BulletParser parser ) { System.err.println( "configure()" ); callback.configure( parser ); } public void endDocument() { System.err.println( "endDocument()" ); callback.endDocument(); } public boolean endElement( final Element element ) { System.err.println( "endElement(" + element + ")" ); return callback.endElement( element ); } public boolean equals( final Object obj ) { return callback.equals( obj ); } public int hashCode() { return callback.hashCode(); } public void startDocument() { System.err.println( "startDocument()" ); callback.startDocument(); } public boolean startElement( final Element element, final Map<Attribute,MutableString> attrMap ) { System.err.println( "endElement(" + element + ", " + attrMap + ")" ); return callback.startElement( element, attrMap ); } public String toString() { return this.getClass().getName() + "(" + callback.toString() + ")"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -