Problem with FileInputStream over MacOs X
807607Dec 18 2006 — edited Dec 18 2006Hello,
I have a problem to copy file in MacOs X.
I have the following function to copy files:
private void copy (String fitxer) {
try {
File src = new File(fitxer);
File dst = new File(PATH + src.getName());
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
} catch (IOException e) {
System.out.println("ReadFile.copy I/O error: " + e.getMessage());
e.printStackTrace();
}
}
And i call the function in the following way:
String nomFitxer = hm.get(FILENAME).toString();
copy(nomFitxer);
where hm is a HashMap.
This works in Windows but not in MacOs. I've tried to change the HashMap for ArrayList and String[] and i have the same result.
Somebody can help me?
Thanks.
PD: I apologize for my bad english.