我一直在用我的raspberry pi构建一个afp (苹果文件协议)服务器。现在,我正尝试在我的笔记本电脑上使用带有java的txt文件。但如果我这样做,它就不起作用了:
try{
BufferedReader reader = new BufferedReader(new FileReader("afp://.......1.txt"));
String line = reader.readLine();
System.out.println(line);
} catch(IOException e) {
System.out.println("File not found");
}结果是“找不到文件”。有人知道它是怎么工作的吗?
File not found
java.io.FileNotFoundException: afp:/....1.txt (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at java.io.FileReader.<init>(FileReader.java:58)
at com.example.pz.Test.main(Test.java:10)发布于 2016-07-02 21:38:31
我不认为java.io.File类开箱即可支持AFP协议。
据我所知,java.io.File仅支持通用I文件系统和中小型企业共享的本地文件系统和UNC路径。
在web上快速浏览一下就会发现Jaffer为Java带来了法新社的支持:https://sourceforge.net/projects/jaffer/
如果让它为您工作,您可以考虑使其适应Apache Virtual Filesystem (VFS)。
https://stackoverflow.com/questions/38048855
复制相似问题