Erro metodo copiar arquiv

1 resposta
progJava

Estou tentando utilizar o metodo para copiar arquivos porém consta o seguinte erro.:

incompatible types
found: java.io.FileInputStream
required.: org.omg.CORBA_2_3.portable.InputStream
trecho.:

is = new FileInputStream(inFile);
os = new FileOutputStream(outFile);

public class a {
    
    /** Creates a new instance of a */
 public boolean a(String inFile, String outFile) {
      InputStream is = null;
      OutputStream os = null;
      byte[] buffer;
      boolean success = true;
      try {
         is = new FileInputStream(inFile);
         os = new FileOutputStream(outFile);
         buffer = new byte[is.available()];
         is.read(buffer);
         os.write(buffer);
      } catch (IOException e) {
         success = false;
      } catch (OutOfMemoryError e) {
         success = false;
      } finally {
         try {
            if (is != null) {
               is.close();
            }
            if (os != null) {
               os.close();
            }
         } catch (IOException e) {}
      }
      return success;
   }



}

1 Resposta

Eric_Yuzo

O problema deve estar no import.

Troque:

import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream;Por:

import java.io.InputStream; import java.io.OutputStream;

Criado 20 de dezembro de 2010
Ultima resposta 20 de dez. de 2010
Respostas 1
Participantes 2