我想从URL下载CSV文件。为此,我使用HTTP URL连接。 运行代码时,我得到以下错误:java.io.IOException:服务器返回的HTTP响应代码:400为URL
java.io.IOException: Server returned HTTP response code: 400 for URL: https://twc.centercode.com/files/report.aspx/PLS Tracker.csv?t=GetElementFullCSV&r=0668821a036046ef9fde587c609e2c8f&e=47437d179bce477f936dcfdc470bf378
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
请找到下面的代码:
final int BUFFER_SIZE = 4096;
String fileURL = "https://twc.centercode.com/files/report.aspx/PLS Tracker.csv?t=GetElementFullCSV&r=0668821a036046ef9fde587c609e2c8f&e=47437d179bce477f936dcfdc470bf378";
String fileName = "EFTReportTest.csv";
String saveDir = "D:\\";
URL url = new URL(fileURL);