title: Apache Tika - detect JSON / PDF specific mime type
body: <p>I'm using <a href="https://tika.apache.org/" rel="nofollow noreferrer">Apache Tika</a> to detect a file Mime Type from its <strong>base64</strong> rapresentation.
  Unfortunately I don't have other info about the file (e.g. extension).</p>
  
  <p>Is there something I can do to make Tika be more specific?</p>
  
  <p>I'm currently using this:</p>
  
  <pre><code>Tika tika = new Tika();
  tika.setMaxStringLength(-1);
  String mimetype = tika.detect(Base64.decode(fileString));
  </code></pre>
  
  <p>and it gives me <code>text/plain</code> for JSON and PDF files, but I would like to obtain a more specific information: <code>application/json</code>, <code>application/pdf</code> etc...</p>
  
  <p>Hope someone can help me!</p>
  
  <p>Thanks.</p>