@Test void testGetResourceAsStream() { AliasedDirectoryResource resource = new AliasedDirectoryResource(null, "/alias"); assertNull(resource.getResourceAsStream("/resource")); }
@Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location.startsWith(alias)) { location = location.substring(alias.length() + 1); File file = new File(rootDirectory, location); try { result = new FileInputStream(file); } catch (FileNotFoundException exception) { } } return result; }
AliasedDirectoryResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location.startsWith(alias)) { location = location.substring(alias.length() + 1); File file = new File(rootDirectory, location); try { result = new FileInputStream(file); } catch (FileNotFoundException exception) { } } return result; } }
AliasedDirectoryResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location.startsWith(alias)) { location = location.substring(alias.length() + 1); File file = new File(rootDirectory, location); try { result = new FileInputStream(file); } catch (FileNotFoundException exception) { } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); }
AliasedDirectoryResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location.startsWith(alias)) { location = location.substring(alias.length() + 1); File file = new File(rootDirectory, location); try { result = new FileInputStream(file); } catch (FileNotFoundException exception) { } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); String getAlias(); File getRootDirectory(); void setAlias(String alias); void setRootDirectory(File rootDirectory); }
AliasedDirectoryResource implements Resource { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; if (location.startsWith(alias)) { location = location.substring(alias.length() + 1); File file = new File(rootDirectory, location); try { result = new FileInputStream(file); } catch (FileNotFoundException exception) { } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); String getAlias(); File getRootDirectory(); void setAlias(String alias); void setRootDirectory(File rootDirectory);  }