Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / resourcesstorage / ResourcesStorage.java @ 1991

History | View | Annotate | Download (1.73 KB)

1
package org.gvsig.tools.resourcesstorage;
2

    
3
import java.io.Closeable;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.io.OutputStream;
7
import java.net.URL;
8
import java.util.List;
9

    
10
/**
11
 *
12
 * @author jjdelcerro
13
 */
14
public interface ResourcesStorage {
15

    
16
    public interface Resource extends Closeable {
17
        /**
18
         * El recurso es de solo lectura, normalmente por que el tipo de recurso
19
         * no permite escribir sobre el.
20
         * 
21
         * Podria devolver false, y a pesar de ello no poder escribir, normalmente
22
         * por carecer de permisos para ello.
23
         * 
24
         * @return 
25
         */
26
        public boolean isReadOnly();
27
    
28
        public URL getURL();
29
        
30
        public boolean exists();
31
        
32
        public InputStream asInputStream() throws IOException;
33
        
34
        public OutputStream asOutputStream() throws IOException;
35
        
36
        @Override
37
        public void close();
38
    }
39
    
40
    public static final ResourcesStorage EMPTY_RESOURCESSTORAGE = new EmptyResourcesStorage();
41
    
42
    public static ResourcesStorage createFilesResourcesStorage(String pathName) {
43
        return new FilesResourcesStorage(pathName);
44
    }
45
    
46
    public static MultiResourcesStorage createMultiResourcesStorage() {
47
        return new BaseMultiResourcesStorage();
48
    }   
49
    
50
    public String getSeparator();
51
    
52
    public Resource getResource(String resourceName);
53
    
54
    public List<Resource> getResources(String resourceName);
55

    
56
    public Resource getLocalizedResource(String resourceName);
57
    
58
    public List<Resource> getLocalizedResources(String resourceName);
59
    
60
    public boolean isEmpty();
61
    
62
    public boolean isReadOnly();
63
    
64
    public boolean exists(String resourceName);
65
}