Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DataSaveSystem;
- import java.io.File;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- import Converter.Converter;
- public class getFullProjekt {
- static ArrayList<File> AllFiles;
- public static byte[][] getFullProjekt(String Projekt){
- AllFiles = new ArrayList<>();
- listf("Projekts/"+Projekt);
- int toCutChars = 10+Projekt.length();
- byte[][] re = new byte[(AllFiles.size()*2)+2][];
- for(int i = 0; i < AllFiles.size();i++){
- String Path = AllFiles.get(i).getPath();
- re[i*2+2] = Path.substring(toCutChars, Path.length()).getBytes();
- re[i*2+3] = Converter.toByteArray(AllFiles.get(i).getPath());
- }
- re[0]= new String("fullProjekt").getBytes();
- re[1]= new String(Projekt).getBytes();
- //File ProjektFolder = new File("Projekts/"+Projekt);
- return re;
- }
- private static List<File> listf(String directoryName) {
- File directory = new File(directoryName);
- List<File> resultList = new ArrayList<File>();
- // get all the files from a directory
- File[] fList = directory.listFiles();
- resultList.addAll(Arrays.asList(fList));
- for (File file : fList) {
- if (file.isFile()) {
- AllFiles.add(file);
- } else if (file.isDirectory()) {
- resultList.addAll(listf(file.getPath()));
- }
- }
- return resultList;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement