コード例 #1
0
 static void checkUserDefinedFileAttributes(
     Map<String, ByteBuffer> attrs1, Map<String, ByteBuffer> attrs2) {
   assert attrs1.size() == attrs2.size();
   for (String name : attrs1.keySet()) {
     ByteBuffer bb1 = attrs1.get(name);
     ByteBuffer bb2 = attrs2.get(name);
     assertTrue(bb2 != null);
     assertTrue(bb1.equals(bb2));
   }
 }
コード例 #2
0
 static Map<String, ByteBuffer> readUserDefinedFileAttributes(Path file) throws IOException {
   UserDefinedFileAttributeView view =
       getFileAttributeView(file, UserDefinedFileAttributeView.class);
   Map<String, ByteBuffer> result = new HashMap<>();
   for (String name : view.list()) {
     int size = view.size(name);
     ByteBuffer bb = ByteBuffer.allocate(size);
     int n = view.read(name, bb);
     assertTrue(n == size);
     bb.flip();
     result.put(name, bb);
   }
   return result;
 }