From 16aa917d09a4cb94c25de34737a08f8dff62d366 Mon Sep 17 00:00:00 2001 From: octopus_yan Date: Sat, 21 Dec 2024 22:09:08 +0800 Subject: [PATCH] chore: rename DownloadBodyHandler --- .../cn/octopusyan/dmt/common/manager/http/HttpUtil.java | 4 ++-- .../{BodyHandler.java => DownloadBodyHandler.java} | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) rename src/main/java/cn/octopusyan/dmt/common/manager/http/response/{BodyHandler.java => DownloadBodyHandler.java} (89%) diff --git a/src/main/java/cn/octopusyan/dmt/common/manager/http/HttpUtil.java b/src/main/java/cn/octopusyan/dmt/common/manager/http/HttpUtil.java index 2bd1e5a..effcb1b 100644 --- a/src/main/java/cn/octopusyan/dmt/common/manager/http/HttpUtil.java +++ b/src/main/java/cn/octopusyan/dmt/common/manager/http/HttpUtil.java @@ -1,7 +1,7 @@ package cn.octopusyan.dmt.common.manager.http; import cn.octopusyan.dmt.common.enums.ProxySetup; -import cn.octopusyan.dmt.common.manager.http.response.BodyHandler; +import cn.octopusyan.dmt.common.manager.http.response.DownloadBodyHandler; import cn.octopusyan.dmt.common.util.JsonUtil; import cn.octopusyan.dmt.model.ProxyInfo; import com.fasterxml.jackson.databind.JsonNode; @@ -130,7 +130,7 @@ public class HttpUtil { } // 下载处理器 - var handler = BodyHandler.create( + var handler = DownloadBodyHandler.create( Path.of(savePath), StandardOpenOption.CREATE, StandardOpenOption.WRITE ); diff --git a/src/main/java/cn/octopusyan/dmt/common/manager/http/response/BodyHandler.java b/src/main/java/cn/octopusyan/dmt/common/manager/http/response/DownloadBodyHandler.java similarity index 89% rename from src/main/java/cn/octopusyan/dmt/common/manager/http/response/BodyHandler.java rename to src/main/java/cn/octopusyan/dmt/common/manager/http/response/DownloadBodyHandler.java index 8934dd8..766856b 100644 --- a/src/main/java/cn/octopusyan/dmt/common/manager/http/response/BodyHandler.java +++ b/src/main/java/cn/octopusyan/dmt/common/manager/http/response/DownloadBodyHandler.java @@ -21,16 +21,16 @@ import java.util.function.Consumer; * @author octopus_yan */ @Slf4j -public class BodyHandler implements HttpResponse.BodyHandler { +public class DownloadBodyHandler implements HttpResponse.BodyHandler { private final HttpResponse.BodyHandler handler; private BiConsumer consumer; - private BodyHandler(HttpResponse.BodyHandler handler) { + private DownloadBodyHandler(HttpResponse.BodyHandler handler) { this.handler = handler; } - public static BodyHandler create(Path directory, OpenOption... openOptions) { - return new BodyHandler(HttpResponse.BodyHandlers.ofFileDownload(directory, openOptions)); + public static DownloadBodyHandler create(Path directory, OpenOption... openOptions) { + return new DownloadBodyHandler(HttpResponse.BodyHandlers.ofFileDownload(directory, openOptions)); } @Override