Guest User

Untitled

a guest
Jan 23rd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.IOException;
  3. import java.net.URL;
  4.  
  5. public class FileBasedResourceLoader extends CachingResourceLoader {
  6. private File root = null;
  7.  
  8. public FileBasedResourceLoader(File root) {
  9. this.root = root;
  10. }
  11.  
  12. protected URL _getResource(String path) throws IOException {
  13. File resourceFile = new File(root, path);
  14. if (resourceFile.exists()) {
  15. timestampLookup.put(path, resourceFile.toURI().toURL());
  16. return resourceFile.toURI().toURL();
  17. } else {
  18. return null;
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment