- Remove s3-lite submodule and replace with AWS SDK and shadow plugin - Implement comprehensive backup commands with list, delete, create, restore, and suspend functionality - Add bundle format with compression support using Zstd and gunzip optimization - Implement local and S3 backup strategies with configurable options - Add backup tracking system with JSON persistence - Improve world directory handling and file exclusion logic - Add standalone bundler tool for bundle creation/extraction - Update Gradle configuration with shadow jar support and dependency management - Enhance configuration system with additional options for compression and temporary directories
34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
package io.ib67.sfcraft.bundler;
|
|
|
|
import java.io.FilterOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
public class EntryOutputStream extends FilterOutputStream {
|
|
/**
|
|
* Creates an output stream filter built on top of the specified
|
|
* underlying output stream.
|
|
*
|
|
* @param out the underlying output stream to be assigned to
|
|
* the field {@code this.out} for later use, or
|
|
* {@code null} if this instance is to be
|
|
* created without an underlying stream.
|
|
*/
|
|
public EntryOutputStream(OutputStream out) {
|
|
super(out);
|
|
}
|
|
|
|
public void write(BundlerEntry entry) throws IOException {
|
|
var fileName = entry.fileName().getBytes(StandardCharsets.UTF_8);
|
|
var buf = ByteBuffer.allocate(4).putInt(entry.unGzipped() ? fileName.length * -1 : fileName.length);
|
|
out.write(buf.array());
|
|
out.write(fileName);
|
|
buf = ByteBuffer.allocate(8 + 8);
|
|
buf.putLong(entry.fileLength());
|
|
buf.putLong(entry.offset());
|
|
out.write(buf.array());
|
|
}
|
|
}
|