title: Is there a way to verify if a file is a special block file in Java?
body: <p>I have a special use case where I need to verify if a file is a special block file (only if my java program is run on Linux). My code can already detect if it's ran on Windows or Linux, so if it's windows I simply invalidate the verification. </p>
  
  <p>For Linux, I was reading about the different <a href="https://docs.oracle.com/javase/tutorial/essential/io/fileAttr.html" rel="nofollow noreferrer">FileAttributeView</a> interfaces; and the first thing that popped up was to use the <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/PosixFileAttributeView.html" rel="nofollow noreferrer">PosixFileAttributeView</a> (since block and char device files are Linux-specific), but after looking further into its Javadoc, it only gives access to the different RWX (read, write, execute permissions relative to the owner, group and others) but nothing about special block files or other file attributes. On the other hand, the <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/BasicFileAttributeView.html" rel="nofollow noreferrer">BasicFileAttributeView</a> is supported by all filesystems and has an instance method called <code>isOther()</code>, this could work but there has to be some other way that's more specific than just knowing that a file is not a regular file, directory or symlink. Knowing that it's <code>something other</code> is just too vague.. Any help is deeply appreciated.</p>