Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ListOfAttributeType;
- import java.io.File;
- import java.io.IOException;
- import java.net.URISyntaxException;
- import java.nio.file.FileStore;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.nio.file.attribute.FileAttributeView;
- import java.nio.file.attribute.FileStoreAttributeView;
- public class FileStoreInstance {
- public static void InitializeeFS() {
- Path path = Paths.get("c:\\Users\\hoz\\Documents\\test.txt");
- try {
- FileStore store = Files.getFileStore(path);
- System.out.println("store.name() = " + store.getTotalSpace());
- } catch (IOException e) {
- e.printStackTrace();
- }
- FileStore fileStore = new FileStore() {
- @Override
- public String name() {
- return null;
- }
- @Override
- public String type() {
- return null;
- }
- @Override
- public boolean isReadOnly() {
- return false;
- }
- @Override
- public long getTotalSpace() throws IOException {
- return 0;
- }
- @Override
- public long getUsableSpace() throws IOException {
- return 0;
- }
- @Override
- public long getUnallocatedSpace() throws IOException {
- return 0;
- }
- @Override
- public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
- return false;
- }
- @Override
- public boolean supportsFileAttributeView(String name) {
- return false;
- }
- @Override
- public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
- return null;
- }
- @Override
- public Object getAttribute(String attribute) throws IOException {
- return null;
- }
- };
- try {
- System.out.println("fileStore.getTotalSpace() = " + fileStore.getTotalSpace());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment