所以,我正在编写 FTP 服务器客户端,但代码无法读取任何文件。我是说。我在下载有一个文件。假设 /Downloads/supplement2.pdf 但我得到一个 FileNotFoundException。即使文件在那里,我可以看到它。我什至创建了一个测试文件夹并将其权限设置为 777。仍然没有。
有没有办法设置netbeans作为超级用户做什么?我是说。我只想复制和粘贴一些东西,但不能。这是复制和粘贴代码。如果您发现它有任何问题,请分享。
public static void copyFile(File in, File out)
throws IOException
{
FileChannel inChannel = new
FileInputStream(in).getChannel();
FileChannel outChannel = new
FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(),
outChannel);
}
catch (IOException e) {
throw e;
}
finally {
if (inChannel != null) inChannel.close();
if (outChannel != null) outChannel.close();
}
}
谢谢