Guest User

Untitled

a guest
Jan 3rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. package ListOfAttributeType;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.net.URISyntaxException;
  6. import java.nio.file.FileStore;
  7. import java.nio.file.Files;
  8. import java.nio.file.Path;
  9. import java.nio.file.Paths;
  10. import java.nio.file.attribute.FileAttributeView;
  11. import java.nio.file.attribute.FileStoreAttributeView;
  12.  
  13. public class FileStoreInstance {
  14.  
  15.     public static void InitializeeFS() {
  16.         Path path = Paths.get("c:\\Users\\hoz\\Documents\\test.txt");
  17.         try {
  18.             FileStore store = Files.getFileStore(path);
  19.             System.out.println("store.name() = " + store.getTotalSpace());
  20.         } catch (IOException e) {
  21.             e.printStackTrace();
  22.         }
  23.  
  24.         FileStore fileStore = new FileStore() {
  25.             @Override
  26.             public String name() {
  27.                 return null;
  28.             }
  29.  
  30.             @Override
  31.             public String type() {
  32.                 return null;
  33.             }
  34.  
  35.             @Override
  36.             public boolean isReadOnly() {
  37.                 return false;
  38.             }
  39.  
  40.             @Override
  41.             public long getTotalSpace() throws IOException {
  42.                 return 0;
  43.             }
  44.  
  45.             @Override
  46.             public long getUsableSpace() throws IOException {
  47.                 return 0;
  48.             }
  49.  
  50.             @Override
  51.             public long getUnallocatedSpace() throws IOException {
  52.                 return 0;
  53.             }
  54.  
  55.             @Override
  56.             public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
  57.                 return false;
  58.             }
  59.  
  60.             @Override
  61.             public boolean supportsFileAttributeView(String name) {
  62.                 return false;
  63.             }
  64.  
  65.             @Override
  66.             public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
  67.                 return null;
  68.             }
  69.  
  70.             @Override
  71.             public Object getAttribute(String attribute) throws IOException {
  72.                 return null;
  73.             }
  74.         };
  75.         try {
  76.             System.out.println("fileStore.getTotalSpace() = " + fileStore.getTotalSpace());
  77.         } catch (IOException e) {
  78.             e.printStackTrace();
  79.         }
  80.     }
  81. }
Add Comment
Please, Sign In to add comment