实验性支持 APNG 图片 (#4205)

This commit is contained in:
Glavo
2025-08-06 16:10:45 +08:00
committed by GitHub
parent f945a85441
commit 3118c87c65
62 changed files with 4924 additions and 101 deletions

View File

@@ -76,6 +76,21 @@ public final class IOUtils {
return new String(readFully(stream), charset);
}
public static void skipNBytes(InputStream input, long n) throws IOException {
while (n > 0) {
long ns = input.skip(n);
if (ns > 0 && ns <= n)
n -= ns;
else if (ns == 0) {
if (input.read() == -1)
throw new EOFException();
n--;
} else {
throw new IOException("Unexpected skip bytes. Expected: " + n + ", Actual: " + ns);
}
}
}
public static void copyTo(InputStream src, OutputStream dest, byte[] buf) throws IOException {
while (true) {
int len = src.read(buf);