Example usage for java.nio.file FileStore isReadOnly

List of usage examples for java.nio.file FileStore isReadOnly

Introduction

In this page you can find the example usage for java.nio.file FileStore isReadOnly.

Prototype

public abstract boolean isReadOnly();

Source Link

Document

Tells whether this file store is read-only.

Usage

From source file:Main.java

public static void main(String[] args) throws IOException {
    FileSystem fileSystem = FileSystems.getDefault();

    for (FileStore store : fileSystem.getFileStores()) {
        System.out.println(store.isReadOnly());
    }//from w  ww  . j ava  2  s  .c  o m
}

From source file:Test.java

public static void main(String[] args) throws Exception {
    FileSystem fileSystem = FileSystems.getDefault();

    for (FileStore fileStore : fileSystem.getFileStores()) {
        long totalSpace = fileStore.getTotalSpace() / kiloByte;
        long usedSpace = (fileStore.getTotalSpace() - fileStore.getUnallocatedSpace()) / kiloByte;
        long usableSpace = fileStore.getUsableSpace() / kiloByte;
        String name = fileStore.name();
        String type = fileStore.type();
        boolean readOnly = fileStore.isReadOnly();
    }// www.  ja  va 2s  .c o  m
}