This repository has been archived on 2024-10-31. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
LibZontreck/src/main/java/dev/zontreck/ariaslib/file/AriaIO.java
2024-10-09 22:21:30 -07:00

34 lines
1,018 B
Java

package dev.zontreck.ariaslib.file;
import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
public class AriaIO {
public static void write(Path fileName, Entry folder) {
try {
DataOutputStream dos = new DataOutputStream(new FileOutputStream(fileName.toFile()));
folder.write(dos);
dos.close();
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static Entry read(Path fileName) {
try {
DataInputStream dis = new DataInputStream(new FileInputStream(fileName.toFile()));
return Entry.read(dis);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static Path resolveDataFile(String main) {
return Paths.get(main + ".aria");
}
}