需求是将一个二进制文件读取
循环将文件中 每 118个字节 存放在Vector中,直到文件结束。
循环将文件中 每 118个字节 存放在Vector中,直到文件结束。
解决方案 »
- jsp页面打开时的问题
- 谁有java语言中字符串加密解密算法??
- 请给我推荐一些 JavaEE的学习资料和视频
- jfreechart的问题
- 求有关Web Service的英文材料
- hibernate3关联时出现的the owning Session was closed如何处理?
- 我今天听一个人所,CMP是给失败的设计,我想听听大家的意见?
- 请问:webservice的整体性能如何?如果我把一些查询分析封装成webservice是否可行?或者它适合何种场合?
- 有关struts-config.xml的小问题
- 我就盛下20分,但是请大家给我建议,
- BEA 的卑鄙手段(转自www.apusic.com)!
- 学习j2ee,哪方面最有用啊?
{
Vector biVec = new Vector();
FileInputStream biStream = null;
try
{
File biFile = new File( filePath );
//if (biFile.exists())
if(biFile.exists() && biFile.isFile() && biFile.canRead())
{
//FileInputStream biStream = new FileInputStream( biFile );
biStream = new FileInputStream( biFile );
int len;
byte[] biByte = new byte[118];
while ( ( len = biStream.read( biByte, 0, 118 ) ) != -1 )
{
biVec.add( biByte );
}
}
}catch( Exception e ){
System.out.println(e.getMessage());
}finally{
try{
if(biStream!=null) biStream.close();
}catch(IOException e){
System.out.println(e.getMessage());
}
}
return biVec;
}