gwl4808306
本帖最后由

本帖最后由 gwl4808306 于 2012-8-25 00:29 编辑

再传一个:)见笑了

[mw_shl_code=java,true]/**

* 读取指定字节长度的文本

* @param byteLen 字节长度

* @return

*/

public String read(int byteLen ) throws FileNotFoundException,IOException {

InputStream fis=null;

String path=super.getPath();

fis=new FileInputStream(path);

byte[] b=new byte[byteLen];

int len=0;

len=fis.read(b);

if(fis!=null){

fis.close();

}

return new String(b,0,len);

}[/mw_shl_code]