01: /* Locator.java
02:
03: {{IS_NOTE
04:
05: Purpose:
06: Description:
07: History:
08: 90/12/07 10:07:23, Create, Tom M. Yeh.
09: }}IS_NOTE
10:
11: Copyright (C) 2001 Potix Corporation. All Rights Reserved.
12:
13: {{IS_RIGHT
14: This program is distributed under GPL Version 2.0 in the hope that
15: it will be useful, but WITHOUT ANY WARRANTY.
16: }}IS_RIGHT
17: */
18: package org.zkoss.util.resource;
19:
20: import java.net.URL;
21: import java.io.InputStream;
22:
23: /**
24: * A locator that is able to locate a resource.
25: *
26: * @author tomyeh
27: * @see Locators#getDefault
28: */
29: public interface Locator {
30: /** Returns the directory used to resolve the relative path, or null
31: * if relative path is not allowed.
32: *
33: * <p>Note: if the returned directory is not null, it must end with '/'.
34: */
35: public String getDirectory();
36:
37: /**
38: * Finds the resource with the given name. A resource is some data
39: * (images, audio, text, etc) that can be accessed by class code in
40: * a way that is independent of the location of the code.
41: *
42: * @return a URL for reading the resource, or null if the resource
43: * could not be found or the caller doesn't have adequate privileges
44: * to get the resource
45: */
46: public URL getResource(String name);
47:
48: /**
49: * Returns an input stream for reading the specified resource.
50: *
51: * @return an input stream for reading the resource, or null if the
52: * resource could not be found or the caller doesn't have adequate
53: * privileges to get the resource
54: */
55: public InputStream getResourceAsStream(String name);
56: }
|