com.danielsomerfield.util.io.FilePathInputStreamFactory.groovy Maven / Gradle / Ivy
package com.danielsomerfield.util.io
class FilePathInputStreamFactory implements InputStreamFactory {
private final String path;
FilePathInputStreamFactory(final String path) {
this.path = path
}
@Override
InputStream getInputStream() {
final File f = new File(path);
f.exists() ? new FileInputStream(path) : new ByteArrayInputStream(new byte[0])
}
}