package com.yutou.bilibili.Tools; import com.yutou.common.utils.Base64Tools; import java.io.File; import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; public class FileServerUtils { public static String toUrl(String file) { return "/file/" + URLEncoder.encode(Base64Tools.encode(file), StandardCharsets.UTF_8); } public static File toFile(String base64) { return new File(URLDecoder.decode(Base64Tools.decode(base64), StandardCharsets.UTF_8)); } }