read failed: EBADF (Bad file number)

匿名 (未验证) 提交于 2019-12-03 01:06:02

问题:

When I try do a copy one file of the external storage for into folder database, this error happens:

java.io.IOException: read failed: EBADF (Bad file number)

This error happens on the line of while of this method

private void copiarBaseDados(InputStream input) throws IOException{   OutputStream output = new FileOutputStream(ConfiguracoesBaseDados.BANCO_PATH + ConfiguracoesBaseDados.BANCO_NOME);   int tamanho;   byte[] buffer = new byte[1024];   while ((tamanho = input.read(buffer)) > 0)         output.write(buffer, 0, tamanho);   output.flush();   output.close();   input.close(); }

Any idea what could be the problem? Thanks

回答1:

Check whether your input(stream) exists before reading.

Also see if you have these permissons:



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!