![]() This approach scales well to very large directories. The class that implements the DirectoryStream interface also implements Iterable, so you can iterate through the directory stream, reading all of the objects. This method returns the entire contents of a directory: files, links, subdirectories, and hidden files. The method java.io.File.getAbsolutePath () is used to obtain the absolute path name of a file or directory in the form of a string. So, if you are listing the contents of the /tmp directory, the entries are returned with the form /tmp/a, /tmp/b, and so on. This method returns an object that implements theĭirectoryStream interface. The Path objects returned by the iterator are the names of the entries resolved against the directory. ![]() You can list all the contents of a directory by using the The first method allows the code to specify a location for the temporary directory and the second method creates a new directory in the default temporary-file directory.
0 Comments
Leave a Reply. |