public class CompressArchiveStructure {
public static Item[] create() {
Item[] items = new Item[5];
items[0] = new Item("info.txt", "This is the info");
byte[] content = new byte[100];
new Random().nextBytes(content);
items[1] = new Item("random-100-bytes.dump", content);
items[2] = new Item("dir1" + File.separator + "file1.txt",
"This file located in a directory 'dir'");
items[3] = new Item("dir2" + File.separator, (byte[]) null);
items[4] = new Item("dir2" + File.separator + "file2.txt",
"This file located in a directory 'dir'");
return items;
}
static class Item {
private String path;
private byte[] content;
Item(String path, String content) {
this(path, content.getBytes());
}
Item(String path, byte[] content) {
this.path= path;
this.content= content;
}
String getPath() {
return path;
}
byte[] getContent() {
return content;
}
}
}