I'm having trouble downloading a rather large text file using java, specifically this:
map.sql
Unfortunately when the file is downloaded I find it isn't complete, and infact the last 20 or so entries are missing
my code:
Any suggestions?
map.sql
Unfortunately when the file is downloaded I find it isn't complete, and infact the last 20 or so entries are missing

my code:
Code:
public void download(String address, String filePath) {
try {
URL url = new URL(address);
URLConnection urlConnection = url.openConnection();
urlConnection.connect();
InputStream input = url.openStream();
FileWriter fw = new FileWriter("map.txt");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input));
String tString = bufferedReader.readLine();
while (tString != null) {
fw.write(tString);
tString = bufferedReader.readLine();
}
} catch(Exception exception) {
exception.printStackTrace();
}
}
Any suggestions?
Last edited: