Project

General

Profile

Revision 2

Fixed many bugs

View differences:

FileManager.java
77 77
        file.delete();
78 78
    }
79 79

  
80
    // Create metafile(TODO add more useful arguments)
81
    // Used to reconstruct the file name when Restoring
82
    public static void metaFile(String path, String fileId) throws IOException {
83

  
84
        // Extract file name
85
        int index = path.lastIndexOf("\\");
86
        String fileName = path.substring(index + 1);
87

  
88
        // Create actual file
89
        File file = new File(fileName + ".meta");
90
        if (file.createNewFile()) {
91
            // TODO File created
92
        } else {
93
            // TODO File already exists
94
        }
95

  
96
        // Write data to file
97
        FileWriter writer = new FileWriter(file);
98
        writer.write("Id:" + fileId);
99
        writer.close();
100

  
101
    }
102

  
103 80
    // Read all bytes of file(generic use)
104 81
    public static byte[] readFile(String path) {
105 82

  

Also available in: Unified diff