How to determine file kind effectively?
<p>The program i am working on looks at various ASCII text files and does some processing. In order to know how to handle things, it needs to know whether file </p>

<pre><code>- IS_EMPTY         // done
- IS_JSON          // done via parsing, using gson
- IS_XML           // done via parsing, using dom4j
- IS_PROPERTIES    
- IS_SCRIPT
</code></pre>

<p>I  wonder if there is an effective way to determine whether file is of type properties without reading each line to see if it contains <code>Key=Value</code> pair?</p>

<p>Additionally, is there an effective way to determine whether file is a shell script?</p>

<p>Are there any parsers available to check this?</p>
