com.talk2object.plum.input.value.UrlFile Maven / Gradle / Ivy
The newest version!
package com.talk2object.plum.input.value;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class UrlFile extends AbstractFile {
URL url;
public UrlFile(URL url) {
this.url = url;
try {
URLConnection c = url.openConnection();
contentType = c.getContentType();
size = c.getContentLengthLong();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public InputStream getInputStream() {
try {
URLConnection c = url.openConnection();
return c.getInputStream();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public String getName() {
return url.getFile();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy