Java tutorial
/** * Licensed to Jasig under one or more contributor license * agreements. See the NOTICE file distributed with this work * for additional information regarding copyright ownership. * Jasig licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a * copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package edu.wisc.ws.client.support; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URL; import org.springframework.core.io.Resource; /** * Wraps another {@link Resource}, delegates all calls to the the wrapped resource. * * @author Eric Dalquist * @version $Revision: 1.1 $ */ public class DelegatingResource implements Resource { protected final Resource resource; public DelegatingResource(Resource resource) { this.resource = resource; } @Override public boolean exists() { return resource.exists(); } @Override public InputStream getInputStream() throws IOException { return resource.getInputStream(); } @Override public boolean isReadable() { return resource.isReadable(); } @Override public boolean isOpen() { return resource.isOpen(); } @Override public URL getURL() throws IOException { return resource.getURL(); } @Override public URI getURI() throws IOException { return resource.getURI(); } @Override public File getFile() throws IOException { return resource.getFile(); } @Override public long lastModified() throws IOException { return resource.lastModified(); } @Override public Resource createRelative(String relativePath) throws IOException { return resource.createRelative(relativePath); } @Override public String getFilename() { return resource.getFilename(); } @Override public String getDescription() { return resource.getDescription(); } @Override public long contentLength() throws IOException { return resource.contentLength(); } @Override public int hashCode() { return resource.hashCode(); } @Override public boolean equals(Object obj) { return resource.equals(obj); } @Override public String toString() { return resource.toString(); } }