Determining binary/text file type in Java?

前端 未结 10 1147
心在旅途
心在旅途 2020-12-02 16:46

Namely, how would you tell an archive (jar/rar/etc.) file from a textual (xml/txt, encoding-independent) one?

10条回答
  •  忘掉有多难
    2020-12-02 17:29

    Run file -bi {filename}. If whatever it returns starts with 'text/', then it's non-binary, otherwise it is. ;-)

提交回复
热议问题