import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
+import java.nio.file.Paths;
+import java.nio.file.Files;
import java.util.List;
public class ArchivedJob {
String path;
+ String id;
int filesize;
List<String> files;
- ArchivedJob (String path) {
- this.path = path;
- }
-
- public boolean getArchiveFromWS() {
- return false;
+ public ArchivedJob(String id) {
+ this.id = id;
}
-
-
- public boolean getArchiveFromWeb (String webpath) throws IOException, MalformedURLException {
+
+ public boolean copyArchiveFromWeb(String webpath) throws IOException, MalformedURLException {
URL website = new URL(webpath);
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(path);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
return true;
}
-
-
+
+ public boolean copyArchiveLocaly(String localpath) throws IOException {
+ Files.copy(Paths.get(localpath), Paths.get(path));
+ return true;
+ }
+
+ public void setArchivePath(String path) {
+ this.path = path;
+ }
+
public int getSize() {
return filesize;
}
-
+
public List<String> unpack() {
if (null != files) {
-
+
}
return files;
}