1.工具类
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UrlFilesToZip {
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(UrlFilesToZip.class);
//url转file
public static File getFileByUrl(String fileUrl, String suffix) {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
BufferedOutputStream stream = null;
InputStream inputStream = null;
File file = null;
try {
URL imageUrl = new URL(fileUrl);
HttpURLConnection conn = (HttpURLConnection) imageUrl.openConnection();
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; M