Restored Archive validating, misc naming...
This commit is contained in:
1 parent
256220ce51
commit
3965827f25
24 files changed
+2320
-2286
No files matched your search
@@ -1,4 +1,8 @@
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* A simple file archive format.
|
||||
@@ -50,6 +54,16 @@ public class FileArchive {
|
||||
}
|
||||
}
|
||||
|
||||
public void export(String s, Path dst) throws IOException {
|
||||
byte[] data = read(s);
|
||||
if (data == null) {
|
||||
throw new FileNotFoundException(s);
|
||||
}
|
||||
try (OutputStream out = Files.newOutputStream(dst)) {
|
||||
out.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] read(String s) throws IOException {
|
||||
int hash = 0;
|
||||
s = s.toUpperCase();
|
||||
|
||||
Reference in new issue
Block a user