Terracotta | 陶瓦联机 (#4215)

Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
This commit is contained in:
Burning_TNT
2025-10-03 20:01:08 +08:00
committed by GitHub
parent 365bb089c5
commit 3c3e2b8cfc
31 changed files with 2453 additions and 70 deletions

View File

@@ -424,7 +424,7 @@ public abstract class FetchTask<T> extends Task<T> {
public abstract void write(byte[] buffer, int offset, int len) throws IOException;
public final void withResult(boolean success) {
public void withResult(boolean success) {
this.success = success;
}

View File

@@ -18,6 +18,7 @@
package org.jackhuang.hmcl.util.io;
import org.jackhuang.hmcl.util.function.ExceptionalPredicate;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.nio.charset.Charset;
@@ -153,6 +154,31 @@ public final class Zipper implements Closeable {
zos.closeEntry();
}
public OutputStream putStream(String path) throws IOException {
zos.putNextEntry(new ZipEntry(normalize(path)));
return new OutputStream() {
public void write(int b) throws IOException {
zos.write(b);
}
public void write(@NotNull byte[] b) throws IOException {
zos.write(b);
}
public void write(@NotNull byte[] b, int off, int len) throws IOException {
zos.write(b, off, len);
}
public void flush() throws IOException {
zos.flush();
}
public void close() throws IOException {
zos.closeEntry();
}
};
}
public void putLines(Stream<String> lines, String path) throws IOException {
zos.putNextEntry(new ZipEntry(normalize(path)));

View File

@@ -112,7 +112,7 @@ public final class SystemUtils {
return Thread.currentThread().getContextClassLoader().getResource("com/sun/tools/attach/VirtualMachine.class") != null;
}
private static void onLogLine(String log) {
public static void onLogLine(String log) {
LOG.info(log);
}
}