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.
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.