1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.locators;
17
18 import java.io.File;
19 import java.io.IOException;
20 import java.io.InputStream;
21
22 /**
23 * <p>
24 * An adapter class for implementing concrete <code>Locator</code> classes.
25 * </p>
26 * <p>
27 * This class implements the <code>Locator</code> interface and provides dummy
28 * implementations for most of the methods defined in this interface. It can
29 * serve as a starting point for the implementation of custom
30 * <code>Locator</code> classes; then the developer only needs to deal with
31 * the methods that are really required.
32 * </p>
33 * <p>
34 * Because the <code>getURL()</code> method must be implemented in every
35 * locator, no dummy implementation for this method is provided.
36 * </p>
37 *
38 * @author Oliver Heger
39 * @version $Id: AbstractLocator.java 205 2012-01-29 18:29:57Z oheger $
40 */
41 public abstract class AbstractLocator implements Locator
42 {
43 /**
44 * Dummy implementation of this interface method. Always returns <b>null</b>.
45 *
46 * @return a file object for the represented resource
47 * @throws LocatorException if an error occurs
48 */
49 public File getFile() throws LocatorException
50 {
51 return null;
52 }
53
54 /**
55 * Dummy implementation of this interface method. Always returns <b>null</b>.
56 *
57 * @return an input stream for the represented resource
58 * @throws IOException if an IO error occurs
59 * @throws LocatorException if an internal error occurs
60 */
61 public InputStream getInputStream() throws IOException, LocatorException
62 {
63 return null;
64 }
65 }