首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android里用POI读取word的字节长度和测试程序读取的字节长度不一致!解决办法

2012-03-11 
android里用POI读取word的字节长度和测试程序读取的字节长度不一致!测试程序:Java codeFile filedoc new

android里用POI读取word的字节长度和测试程序读取的字节长度不一致!
测试程序:

Java code
File filedoc = new File("D:\\ipr\\司机手册.doc");FileInputStream in = new FileInputStream(filedoc);WordExtractor   extractor   =   new   WordExtractor(in); String docText = extractor.getText();String[] docParaText = extractor.getParagraphText();System.out.println(docParaText.length);System.out.println(docText.getBytes().length);

android 环境下:
一个单独的类:
Java code
public class ReadFileRandom {    //private RandomAccessFile randomAccessFile = null;    private InputStream dataInputStream = null;    private String filePath = null;    private String docStrContent=null;  public ReadFileRandom(String path) throws IOException {        this.filePath = path;        try {        if(Constant.DOC_PREFIX.equals("txt"))        {          dataInputStream = new DataInputStream(new FileInputStream(filePath));        }        else if(Constant.DOC_PREFIX.equals("doc"))        {          FileInputStream in = new FileInputStream(filePath);          WordExtractor   extractor   =   new   WordExtractor(in);          docStrContent = extractor.getText();        }        } catch (FileNotFoundException e) {        }    }


[解决办法]
详细描述一下
[解决办法]
WordExtractor 类怎么写的

热点排行