<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [resolved] How to Extract a files MIME type? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Extract-a-files-MIME-type/m-p/2315199#M85883</link>
    <description>Just worked this out;&lt;BR /&gt;Created new routine "mime" (Obviously needs some tidying)&lt;BR /&gt;"package routines;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.nio.file.Files;&lt;BR /&gt;import java.nio.file.Path;&lt;BR /&gt;import java.nio.file.Paths;&lt;BR /&gt;public class mime {&lt;BR /&gt;	 public static String main(String path) throws IOException {&lt;BR /&gt;		    Path source = Paths.get(path);&lt;BR /&gt;		    return Files.probeContentType(source);&lt;BR /&gt;		  }&lt;BR /&gt;}&lt;BR /&gt;"&lt;BR /&gt;Then used mime.main({path}) to get the mime_type.&lt;BR /&gt;This seams to work ok(only for java 7 I believe), would still be interested to hear if there is an OOB way to do this.</description>
    <pubDate>Mon, 02 Sep 2013 12:52:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-09-02T12:52:05Z</dc:date>
    <item>
      <title>[resolved] How to Extract a files MIME type?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Extract-a-files-MIME-type/m-p/2315198#M85882</link>
      <description>Hi I'm migrating an archived directory of files into a storage system, this system needs to have the mime type of the files inserted into its db.
&lt;BR /&gt;I had hoped that either the tFileList or tFileProperties component would have the mime type but this is not present.
&lt;BR /&gt;I've also tried several snippets of Java code as per 
&lt;A href="http://stackoverflow.com/questions/51438/getting-a-files-mime-type-in-java" target="_blank" rel="nofollow noopener noreferrer"&gt;http://stackoverflow.com/questions/51438/getting-a-files-mime-type-in-java&lt;/A&gt;, with no success. 
&lt;BR /&gt;Is there a talend component that can extract mime types? Alternately is there a piece of Java code that would do the job?
&lt;BR /&gt;I could go down the route of parsing the extension out and using a crude lookup table but hope there is a more elegant way.
&lt;BR /&gt;Cheers Andy</description>
      <pubDate>Mon, 02 Sep 2013 12:14:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Extract-a-files-MIME-type/m-p/2315198#M85882</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-02T12:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Extract a files MIME type?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Extract-a-files-MIME-type/m-p/2315199#M85883</link>
      <description>Just worked this out;&lt;BR /&gt;Created new routine "mime" (Obviously needs some tidying)&lt;BR /&gt;"package routines;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.nio.file.Files;&lt;BR /&gt;import java.nio.file.Path;&lt;BR /&gt;import java.nio.file.Paths;&lt;BR /&gt;public class mime {&lt;BR /&gt;	 public static String main(String path) throws IOException {&lt;BR /&gt;		    Path source = Paths.get(path);&lt;BR /&gt;		    return Files.probeContentType(source);&lt;BR /&gt;		  }&lt;BR /&gt;}&lt;BR /&gt;"&lt;BR /&gt;Then used mime.main({path}) to get the mime_type.&lt;BR /&gt;This seams to work ok(only for java 7 I believe), would still be interested to hear if there is an OOB way to do this.</description>
      <pubDate>Mon, 02 Sep 2013 12:52:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Extract-a-files-MIME-type/m-p/2315199#M85883</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-02T12:52:05Z</dc:date>
    </item>
  </channel>
</rss>

