Java FileStore getStorageName(final File file)

Here you can find the source of getStorageName(final File file)

Description

Returns a storage name (volume name).

License

Open Source License

Parameter

Parameter Description
file the file.

Exception

Parameter Description
IOException I/O exception.

Return

the storage name (volume name).

Declaration

public static String getStorageName(final File file) throws IOException 

Method Source Code


//package com.java2s;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileStore;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    /**/*from  w  ww  .  j  a v a2  s .  c  om*/
     * Returns a storage name (volume name).
     * 
     * @param file
     *            the file.
     * @return the storage name (volume name).
     * @throws IOException
     *             I/O exception.
     */
    public static String getStorageName(final File file) throws IOException {
        Path path = Paths.get(file.getPath());
        FileStore fs = Files.getFileStore(path);
        String storageName = fs.name();
        return storageName;
    }
}

Related

  1. getAclAttributes(Path file)
  2. getFileStore(Path path)
  3. getFileStore(URI uri)
  4. getMountPoint(FileStore store)
  5. getPosixAttributes(Path file)
  6. getTopResourceInVolume(URI location)
  7. isPosixFileStore(Path path)
  8. isPosixFileSystem()
  9. spinsLinux(Path path)