Fix range download (again)

This commit is contained in:
2022-12-15 19:21:00 +01:00
parent 828a3e9ef5
commit dabf3f562a
3 changed files with 50 additions and 2 deletions

View File

@@ -12,10 +12,10 @@
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-plugin.version>2.14.2.Final</quarkus-plugin.version>
<quarkus-plugin.version>2.15.0.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.14.2.Final</quarkus.platform.version>
<quarkus.platform.version>2.15.0.Final</quarkus.platform.version>
<surefire-plugin.version>2.22.1</surefire-plugin.version>
</properties>
<dependencyManagement>

View File

@@ -119,6 +119,53 @@ class FileServeInputStream extends InputStream {
this.remaining = endRange + 1 - startRange;
}
@Override
public int available() throws IOException {
return this.is.available();
}
@Override
public void close() throws IOException {
this.is.close();
}
@Override
public int read(byte[] buffer, int off, int len) throws IOException {
if (this.remaining == 0) {
this.is.close();
return -1;
} else {
int read = this.is.read(buffer, off, (int) Math.min(len, this.remaining));
this.remaining -= read;
return read;
}
}
@Override
public byte[] readAllBytes() throws IOException {
return this.is.readAllBytes();
}
@Override
public byte[] readNBytes(int arg0) throws IOException {
return this.is.readNBytes(arg0);
}
@Override
public int readNBytes(byte[] arg0, int arg1, int arg2) throws IOException {
return this.is.readNBytes(arg0, arg1, arg2);
}
@Override
public long skip(long arg0) throws IOException {
return this.is.skip(arg0);
}
@Override
public void skipNBytes(long arg0) throws IOException {
this.is.skipNBytes(arg0);
}
@Override
public int read(byte[] buffer) throws IOException {
if (this.remaining == 0) {

View File

@@ -10,6 +10,7 @@ quarkus:
native:
container-build: true
container-runtime: docker
builder-image: quay.io/quarkus/ubi-quarkus-mandrel:22.3-java17
enable-all-security-services: true
enable-https-url-handler: true