android导入现存数据库出IO异常用inputstream已经读到了数据库文件而且大小也与实际相符但是当用inputstre
android导入现存数据库出IO异常
用inputstream已经读到了数据库文件而且大小也与实际相符但是当用inputstream的时候会报IO异常,代码如下
if(!(new File(path).exists()))
{
InputStream is=this.context.getResources().openRawResource(R.raw.pb_product);
FileOutputStream fos=new FileOutputStream(path);
while(BUFFER_SIZE==0)
{
BUFFER_SIZE=is.available();
}
byte[] buffer=new byte[BUFFER_SIZE];
int count=0;
while((count=is.read(buffer,0,BUFFER_SIZE))>-1)
{
fos.write(buffer);
}
fos.close();
is.close();
路径都没有错误
[解决办法]
