initial structuring

This commit is contained in:
Downforce Agent 2024-08-12 20:13:32 -05:00
parent 1c0f410aef
commit 0d00360b03

View File

@ -1,7 +1,12 @@
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.zip.Deflater;
import java.io.RandomAccessFile;
public class Scotty { public class Scotty {
public enum CompressionFormats { public enum CompressionFormats {
@ -19,7 +24,8 @@ public class Scotty {
public enum PathModes { public enum PathModes {
RELATIVE(0), RELATIVE(0),
ABSOLUTE(1); IGNORE_CASE(1),
ABSOLUTE(2);
private final int value; private final int value;
PathModes(final int value) {this.value = value;} PathModes(final int value) {this.value = value;}
@ -53,10 +59,12 @@ public class Scotty {
} }
public class PSARC { public class PSARC {
public byte[] version = new byte[]{0, 0, 0, 0}; // fixed length of 32 bits
public CompressionFormats algorithm = CompressionFormats.ZLIB; // the algorithm used to compress the files public CompressionFormats algorithm = CompressionFormats.ZLIB; // the algorithm used to compress the files
public byte strength = 9; // intensity of the compression algorithm from 0 to 9 public byte strength = 9; // intensity of the compression algorithm from 0 to 9
public long blockSize = 65536; public long blockSize = 65536;
private File fromDisk = null; public PathModes mode = PathModes.RELATIVE;
private RandomAccessFile fromDisk = null; // if NULL then file is a new file
private List<CompressedFile> files = new ArrayList<CompressedFile>(); private List<CompressedFile> files = new ArrayList<CompressedFile>();
public PSARC() { // new w/ defaults public PSARC() { // new w/ defaults
@ -65,6 +73,11 @@ public class Scotty {
public PSARC(File location) { // existing public PSARC(File location) { // existing
// todo: read psarc and set vars above // todo: read psarc and set vars above
try {fromDisk = new RandomAccessFile(location, "read");} catch (
FileNotFoundException e) {throw new RuntimeException(e);
}
System.out.println();
} }
public PSARC(CompressionFormats algorithm, byte strength) { // new public PSARC(CompressionFormats algorithm, byte strength) { // new