@Test public void asResource() throws IOException { Resource resource = ResourceUtils.asResource(TEXT_FILE_PATH); assertNotNull(resource); assertTrue(resource.isReadable()); }
public static Resource asResource(String location) throws IOException { Validate.notEmpty(location); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource resource = resolver.getResource(location); if(!resource.isReadable()) { throw new IOException("Can't find resource at " + location); } return resource; }
ResourceUtils { public static Resource asResource(String location) throws IOException { Validate.notEmpty(location); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource resource = resolver.getResource(location); if(!resource.isReadable()) { throw new IOException("Can't find resource at " + location); } return resource; } }
ResourceUtils { public static Resource asResource(String location) throws IOException { Validate.notEmpty(location); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource resource = resolver.getResource(location); if(!resource.isReadable()) { throw new IOException("Can't find resource at " + location); } return resource; } private  ResourceUtils(); }
ResourceUtils { public static Resource asResource(String location) throws IOException { Validate.notEmpty(location); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource resource = resolver.getResource(location); if(!resource.isReadable()) { throw new IOException("Can't find resource at " + location); } return resource; } private  ResourceUtils(); static InputStream asInputStream(String location); static Properties asProperties(String location); static String asString(String location, Charset encoding); static String asString(String location); static Resource asResource(String location); }
ResourceUtils { public static Resource asResource(String location) throws IOException { Validate.notEmpty(location); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource resource = resolver.getResource(location); if(!resource.isReadable()) { throw new IOException("Can't find resource at " + location); } return resource; } private  ResourceUtils(); static InputStream asInputStream(String location); static Properties asProperties(String location); static String asString(String location, Charset encoding); static String asString(String location); static Resource asResource(String location);  }