001: /*
002: * Copyright (c) 2001-2007, Jean Tessier
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions
007: * are met:
008: *
009: * * Redistributions of source code must retain the above copyright
010: * notice, this list of conditions and the following disclaimer.
011: *
012: * * Redistributions in binary form must reproduce the above copyright
013: * notice, this list of conditions and the following disclaimer in the
014: * documentation and/or other materials provided with the distribution.
015: *
016: * * Neither the name of Jean Tessier nor the names of his contributors
017: * may be used to endorse or promote products derived from this software
018: * without specific prior written permission.
019: *
020: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
023: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
024: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
027: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
028: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031: */
032:
033: package com.jeantessier.classreader;
034:
035: import java.io.*;
036: import java.util.*;
037:
038: public abstract class ClassfileLoaderDecorator extends ClassfileLoader {
039: private ClassfileLoader loader;
040:
041: public ClassfileLoaderDecorator(ClassfileLoader loader) {
042: this .loader = loader;
043: }
044:
045: protected ClassfileLoader getLoader() {
046: return loader;
047: }
048:
049: public Classfile getClassfile(String name) {
050: return getLoader().getClassfile(name);
051: }
052:
053: public Collection<Classfile> getAllClassfiles() {
054: return getLoader().getAllClassfiles();
055: }
056:
057: public Collection<String> getAllClassNames() {
058: return getLoader().getAllClassNames();
059: }
060:
061: public void addLoadListener(LoadListener listener) {
062: getLoader().addLoadListener(listener);
063: }
064:
065: public void removeLoadListener(LoadListener listener) {
066: getLoader().removeLoadListener(listener);
067: }
068:
069: protected void fireBeginSession() {
070: getLoader().fireBeginSession();
071: }
072:
073: protected void fireBeginGroup(String groupName, int size) {
074: getLoader().fireBeginGroup(groupName, size);
075: }
076:
077: protected void fireBeginFile(String filename) {
078: getLoader().fireBeginFile(filename);
079: }
080:
081: protected void fireBeginClassfile(String filename) {
082: getLoader().fireBeginClassfile(filename);
083: }
084:
085: protected void fireEndClassfile(String filename, Classfile classfile) {
086: getLoader().fireEndClassfile(filename, classfile);
087: }
088:
089: protected void fireEndFile(String filename) {
090: getLoader().fireEndFile(filename);
091: }
092:
093: protected void fireEndGroup(String groupName) {
094: getLoader().fireEndGroup(groupName);
095: }
096:
097: protected void fireEndSession() {
098: getLoader().fireEndSession();
099: }
100:
101: protected Classfile load(DataInputStream in) throws IOException {
102: return getLoader().load(in);
103: }
104: }
|