< prev index next >

src/java.base/linux/classes/sun/nio/fs/MagicFileTypeDetector.java

Print this page




  51             return null;
  52 
  53         UnixPath path = (UnixPath) obj;
  54         path.checkRead();
  55 
  56         NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
  57         try {
  58             byte[] type = probe0(buffer.address());
  59             String mimeType = (type == null) ? null : new String(type);
  60             return UNKNOWN_MIME_TYPE.equals(mimeType) ? null : mimeType;
  61         } finally {
  62             buffer.release();
  63         }
  64     }
  65 
  66     private static native boolean initialize0();
  67 
  68     private static native byte[] probe0(long pathAddress);
  69 
  70     static {
  71         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  72             @Override
  73             public Void run() {
  74                 System.loadLibrary("nio");
  75                 return null;
  76             }
  77         });
  78     }
  79 }


  51             return null;
  52 
  53         UnixPath path = (UnixPath) obj;
  54         path.checkRead();
  55 
  56         NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
  57         try {
  58             byte[] type = probe0(buffer.address());
  59             String mimeType = (type == null) ? null : new String(type);
  60             return UNKNOWN_MIME_TYPE.equals(mimeType) ? null : mimeType;
  61         } finally {
  62             buffer.release();
  63         }
  64     }
  65 
  66     private static native boolean initialize0();
  67 
  68     private static native byte[] probe0(long pathAddress);
  69 
  70     static {
  71         AccessController.doPrivileged(new PrivilegedAction<>() {
  72             @Override
  73             public Void run() {
  74                 System.loadLibrary("nio");
  75                 return null;
  76             }
  77         });
  78     }
  79 }
< prev index next >