Hallo, ich kopiere Bilder und dabei sind die z.T. zur Hälfte mit anderer Farbe,
siehe hier Gedore 165 TX T6 Elektronik-Schraubendreher, Innen-TORX T6 | eBay
das ist die Funktion - was ist falsch ?
siehe hier Gedore 165 TX T6 Elektronik-Schraubendreher, Innen-TORX T6 | eBay
das ist die Funktion - was ist falsch ?
Java:
public String downloadImage(String url, String localFileName) {
InputStream openStream = null;
BufferedInputStream bufIn = null;
FileOutputStream fos = null;
BufferedOutputStream bufOut = null;
String fileName = null;
try {
URL _url = new URL(url);
URLConnection con = _url.openConnection();
openStream = con.getInputStream();
bufIn = new BufferedInputStream(openStream);
byte[] in = new byte[1024];
int count = 0;
String fName = getLocalfilePath( localFileName );
log.info("Downloading " + url + " to " + localFileName);
fos = new FileOutputStream(new File(fName));
bufOut = new BufferedOutputStream(fos);
while ((count = bufIn.read(in)) != -1) {
bufOut.write(in, 0, count);
}
fileName = fName;
} catch( FileNotFoundException e ) {
log.log(Level.SEVERE, null, e);
return INVALID_LINK;
} catch (IOException e) {
log.log(Level.SEVERE, null, e);
} finally {
if (bufIn != null) {
try {
bufIn.close();
} catch (Exception e) {
}
}
if (bufOut != null) {
try {
bufOut.close();
} catch (Exception e) {
}
}
}
return fileName;
}