Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with FileInputStream over MacOs X

807607Dec 18 2006 — edited Dec 18 2006
Hello,

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2007
Added on Dec 18 2006
10 comments
619 views