-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileHandler.java
More file actions
50 lines (43 loc) · 1.43 KB
/
FileHandler.java
File metadata and controls
50 lines (43 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package net.theevilreaper.aves.file;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Optional;
/**
* The class represents the base logic to load or save json files.
*
* @author theEvilReaper
* @version 1.0.0
* @since 1.0.0
* * @deprecated This interface is deprecated since version 1.9.0 and will be removed in a future release. Use {@link ModernFileHandler} instead.
**/
@Deprecated(since = "1.9.0", forRemoval = true)
public interface FileHandler {
/**
* The logger for the {@link FileHandler}.
*/
Logger LOGGER = LoggerFactory.getLogger(FileHandler.class);
/**
* The default charset used for reading and writing files.
*/
Charset UTF_8 = StandardCharsets.UTF_8;
/**
* Saves a given object into a file.
*
* @param path The path where the file is located
* @param object The object to save
* @param <T> A generic type for the object value
*/
<T> void save(Path path, T object);
/**
* Load a given file and parse to the give class.
*
* @param path is the where the file is located
* @param clazz Represents the class which should be loaded
* @param <T> is generic type for the object value
* @return a {@link Optional} with the object instance
*/
<T> Optional<T> load(Path path, Class<T> clazz);
}