vitality4j/Scotty.java

114 lines
3.2 KiB
Java

import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.Deflater;
import java.io.RandomAccessFile;
public class Scotty {
public enum CompressionFormats {
NONE(0),
ZLIB(1),
LZMA(2);
private final int value;
CompressionFormats(final int value) {this.value = value;}
public int getValue() {
return value;
}
}
public enum PathModes {
RELATIVE(0),
ABSOLUTE(1);
private final int value;
PathModes(final int value) {this.value = value;}
public int getValue() {
return value;
}
}
public class CompressedFile {
private final PSARC container;
private final String path;
public CompressionFormats algorithm = null; // if NULL then it inherits the value from the entire PSARC file
public CompressedFile(PSARC container, String path) {
this.container = container;
this.path = path;
}
public PSARC getContainer() {
return container;
}
public String getLocationInArchive() {
return path;
}
public InputStream getIOStream() {
throw new UnsupportedOperationException();
}
}
public class PSARC {
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 long blockSize = 65536;
private File fromDisk = null;
private List<CompressedFile> files = new ArrayList<CompressedFile>();
public PSARC() { // new w/ defaults
// use defaults, do nothing
}
public PSARC(File location) { // existing
// todo: read psarc and set vars above
}
public PSARC(CompressionFormats algorithm, byte strength) { // new
this.algorithm = algorithm;
this.strength = strength;
}
public PSARC(CompressionFormats algorithm, byte strength, long blockSize) { // new
this.algorithm = algorithm;
this.strength = strength;
this.blockSize = blockSize;
}
public List<CompressedFile> listAllFiles() {
return files;
}
public String[] listAllFilePaths() {
throw new UnsupportedOperationException();
}
public boolean addFile(File input) {
throw new UnsupportedOperationException();
}
public boolean writeOut(File destination) {
throw new UnsupportedOperationException();
}
public boolean extractAll(File destination) {
throw new UnsupportedOperationException();
}
public boolean extractSingleFile(CompressedFile target, File destination) {
throw new UnsupportedOperationException();
}
public boolean extractMultipleFiles(List<CompressedFile> targets, File directory) {
throw new UnsupportedOperationException();
}
}
}