chore: rename BodyHandler

This commit is contained in:
octopus_yan 2024-12-21 22:08:20 +08:00
parent 9e9a1b22b7
commit 50cba0557f
2 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
package cn.octopusyan.alistgui.manager.http; package cn.octopusyan.alistgui.manager.http;
import cn.octopusyan.alistgui.enums.ProxySetup; import cn.octopusyan.alistgui.enums.ProxySetup;
import cn.octopusyan.alistgui.manager.http.handler.BodyHandler; import cn.octopusyan.alistgui.manager.http.handler.DownloadBodyHandler;
import cn.octopusyan.alistgui.model.ProxyInfo; import cn.octopusyan.alistgui.model.ProxyInfo;
import cn.octopusyan.alistgui.util.JsonUtil; import cn.octopusyan.alistgui.util.JsonUtil;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@ -126,7 +126,7 @@ public class HttpUtil {
} }
// 下载处理器 // 下载处理器
var handler = BodyHandler.create( var handler = DownloadBodyHandler.create(
Path.of(savePath), Path.of(savePath),
StandardOpenOption.CREATE, StandardOpenOption.WRITE StandardOpenOption.CREATE, StandardOpenOption.WRITE
); );

View File

@ -21,16 +21,16 @@ import java.util.function.Consumer;
* @author octopus_yan * @author octopus_yan
*/ */
@Slf4j @Slf4j
public class BodyHandler implements HttpResponse.BodyHandler<Path> { public class DownloadBodyHandler implements HttpResponse.BodyHandler<Path> {
private final HttpResponse.BodyHandler<Path> handler; private final HttpResponse.BodyHandler<Path> handler;
private BiConsumer<Long, Long> consumer; private BiConsumer<Long, Long> consumer;
private BodyHandler(HttpResponse.BodyHandler<Path> handler) { private DownloadBodyHandler(HttpResponse.BodyHandler<Path> handler) {
this.handler = handler; this.handler = handler;
} }
public static BodyHandler create(Path directory, OpenOption... openOptions) { public static DownloadBodyHandler create(Path directory, OpenOption... openOptions) {
return new BodyHandler(HttpResponse.BodyHandlers.ofFileDownload(directory, openOptions)); return new DownloadBodyHandler(HttpResponse.BodyHandlers.ofFileDownload(directory, openOptions));
} }
@Override @Override