Revision 37498 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/DefaultSwingInstallerManager.java
DefaultSwingInstallerManager.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.installer.swing.impl; |
29 | 29 |
|
30 |
import java.io.BufferedReader; |
|
30 | 31 |
import java.io.File; |
32 |
import java.io.FileInputStream; |
|
33 |
import java.io.FileNotFoundException; |
|
34 |
import java.io.IOException; |
|
35 |
import java.io.InputStream; |
|
36 |
import java.io.InputStreamReader; |
|
31 | 37 |
import java.net.MalformedURLException; |
32 | 38 |
import java.net.URL; |
33 | 39 |
import java.util.ArrayList; |
... | ... | |
165 | 171 |
this.defaultDownloadURLs.add(defaultDownloadURL); |
166 | 172 |
} |
167 | 173 |
|
174 |
public void setDefaultDownloadURL(File defaultDownloadURLs) { |
|
175 |
InputStream is; |
|
176 |
try { |
|
177 |
is = new FileInputStream(defaultDownloadURLs); |
|
178 |
} catch (FileNotFoundException e1) { |
|
179 |
logger.error("Can't open the file "+defaultDownloadURLs.getName(), e1); |
|
180 |
return; |
|
181 |
} |
|
182 |
BufferedReader in = new BufferedReader(new InputStreamReader(is)); |
|
183 |
String line = null; |
|
184 |
try { |
|
185 |
for (line = in.readLine(); line != null; line = in.readLine()) { |
|
186 |
try { |
|
187 |
this.addDefaultDownloadURL(new URL(line)); |
|
188 |
} catch (MalformedURLException e) { |
|
189 |
logger.error( |
|
190 |
"Error creating the default packages download URL pointing to " |
|
191 |
+ line, e); |
|
192 |
} |
|
193 |
} |
|
194 |
} catch (IOException e) { |
|
195 |
logger.error( |
|
196 |
"Error reading the file " |
|
197 |
+ defaultDownloadURLs.getName(), e); |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
168 | 201 |
public void addDefaultDownloadURL(URL url) { |
169 | 202 |
this.defaultDownloadURLs.add(url); |
170 | 203 |
} |
Also available in: Unified diff