设为首页 加入收藏

TOP

Java获得文件编码格式
2014-11-17 18:26:26 】 浏览:382
Tags:Java 获得 文件 编码 格式

  Java代码


  import info.monitorenter.cpdetector.io.CodepageDetectorProxy;


  import info.monitorenter.cpdetector.io.JChardetFacade;


  import java.io.File;


  import java.nio.charset.Charset;


  public class CharacterEnding {


  public static String getFileCharacterEnding(String filePath) {


  File file = new File(filePath);


  return getFileCharacterEnding(file);


  }


  /**


  * Try to get file character ending.



  * cpDetector to detect file's encoding.


  *


  * @param file


  * @return


  */


  public static String getFileCharacterEnding(File file) {


  String fileCharacterEnding = "UTF-8";


  CodepageDetectorProxy detector = CodepageDetectorProxy.getInstance();


  detector.add(JChardetFacade.getInstance());


  Charset charset = null;


  // File f = new File(filePath);


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇java实现彩色图转变为灰度图 下一篇运用JAVA读取txt文件

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目