how to read a file with non-ascii file name

G

guava

Hi,

Does anyone know how to open a FileInputStream on a file with
non-ascii file name?

I have some code like the following:
***************************************************************
import java.io.*;

public class CopyFile
{
public static void main(String[] args)
throws IOException
{
File src = new File(args[0]);
File dest = new File(args[1]);

File[] list = src.listFiles();
for ( int i = 0; i < list.length; i++ )
{
int len = (int) list.length();
byte[] buf = new byte[len];
DataInputStream in = new DataInputStream(new
FileInputStream(list)));
in.readFully(buf);
FileOutputStream out = new FileOutputStream(new File(dest,
list.getName()));
out.write(buf);
out.flush();
in.close();
out.close();
}
}
}

****************************************************

My problem is that I will get a FileNotFoundException when I tried to
open the FileInputStream on a filename with non-ascii characters.


Thanks for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top