简体   繁体   中英

How to read from file in temp?

i have problem, how to read file in temp and get filename ?

  tempFile = File.createTempFile("MyFile.txt", ".tmp" );
  System.out.print("Created temporary file with name ");
  System.out.println(tempFile.getAbsolutePath());
  1. Reading a file in a temporary directory is done in exactly the same way as non-temporary files are read.

  2. getAbsolutePath() returns the absolute path name of the file. If by "file name" you refer to just the "file" portion of the path name, use the getName() method.

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