com.giraone.io.copier.resource.DirectReadFromUrlStreamProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of file-tree-copier Show documentation
Show all versions of file-tree-copier Show documentation
Utility JAR for copying a file tree from web server or from classpath resources to a (local) file system.
The newest version!
package com.giraone.io.copier.resource;
import com.giraone.io.copier.ReadFromUrlStreamProvider;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/**
* The default implementation for reading content from a URL.
* This is simply {@link URL#openStream()}.
*/
public class DirectReadFromUrlStreamProvider implements ReadFromUrlStreamProvider {
@Override
public InputStream openInputStream(URL url) {
try {
return url.openStream();
} catch (IOException e) {
throw new RuntimeException("Cannot open URL \"" + url + "\"", e);
}
}
}