可以File
public File(URI uri)
Creates a new File instance by converting the given file: URI into an abstract pathname. 
The exact form of a file: URI is system-dependent, hence the transformation performed by this constructor is also system-dependent. For a given abstract pathname f it is guaranteed that new File( f.toURI()).equals( f.getAbsoluteFile()) 
so long as the original abstract pathname, the URI, and the new abstract pathname are all created in (possibly different invocations of) the same Java virtual machine. This relationship typically does not hold, however, when a file: URI that is created in a virtual machine on one operating system is converted into an abstract pathname in a virtual machine on a different operating system. Parameters:
uri - An absolute, hierarchical URI with a scheme equal to "file", a non-empty path component, and undefined authority, query, and fragment components 
Throws: 
NullPointerException - If uri is null 
IllegalArgumentException - If the preconditions on the parameter do not hold
Since: 
1.4 
See Also:
toURI(), URI

解决方案 »

  1.   

    用 File 就只能是本地的, 如果要永远程的就只能用  URL 类,
    InputStream in = new URL("ftp://username:password@server/path/filename.ext").openStream();new URL("jar:http://www.abc.com/jars/rt.jar!/java/lang/Object.class").openStream();
      

  2.   

    等到InputStream怎样创建File对象呀,或者怎么生成文件?给个源码,谢谢
      

  3.   

    interhanchi,humanity:你们能给一个完整的源码吗?谢谢了,不论怎么方式,只要可以得到远程File对象,谢谢了,急啊...
      

  4.   

    就是获得了InputStream,怎么创建一个文件对象
      

  5.   

    我也需要把远程的rul的InputStream,可是我也不知道怎么样转化为file的格式的。如果直接用inputstream又没办法进行实例化。
    我搞这个都一个星期多了,都快要没信心了。真是郁闷啊