简体   繁体   中英

Is Java “File” and “Files” only meant for local system?

可以处理另一台计算机上的远程文件路径的IO类是什么?

A File class represents a binary file. With the line

File f = new file(path)

You access at least a binary on your local filesystem or on a network filesystem, with

path = "\\\\192.168.1.50\\home\\hello.txt";

And I think that's all. According to the official documentation of Java 7 :

User interfaces and operating systems use system-dependent pathname strings to name files and directories. This class presents an abstract, system-independent view of hierarchical pathnames. An abstract pathname has two components:

An optional system-dependent prefix string, such as a disk-drive specifier, "/" for the UNIX root directory, or "\\\\" for a Microsoft Windows UNC pathname, and

A sequence of zero or more string names.

Source : enter link description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM