Jump to content
Sign in to follow this  
webax

copy a file

Recommended Posts

hello

(sorry, I'm french and don't speak English very well)

I test scriptmaster, and I want to copy one file in other directory from my filemaker server/IWP

I write this code


java.io.FileInputStream sourceFile=null;

java.io.FileOutputStream destinationFile=null; 

new File(destination).createNewFile(); 

sourceFile = new java.io.FileInputStream(source); 

destinationFile = new java.io.FileOutputStream(destination); 

byte buffer[]=new byte[512*1024]; 

int nbLecture;

while( (nbLecture = sourceFile.read(buffer)) != -1 ) {

destinationFile.write(buffer, 0, nbLecture);

} 

but scriptmaster return an error about the type "BYTE":

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 11: Primitive type literal: byte cannot be used as a method name at line: 11 column: 1. File: Script1.groovy @ line 11, column 1.

anyone had any idea about this problem ?

thanks a lot !!!!

Share this post


Link to post
Share on other sites

Je ne connais pas trop le java mais à ce que je peux comprendre, vous avez utilisé un mot réservé - "byte" pour nommer la commande envoyé. Je ne vous garantis rien, mais essayez de changer la ligne:

byte buffer[]=new byte[512*1024];

en (par exemple)

ByteBuffer buffer[]=new byte[512*1024];

Share this post


Link to post
Share on other sites

Je ne connais pas trop le java mais à ce que je peux comprendre, vous avez utilisé un mot réservé - "byte" pour nommer la commande envoyé. Je ne vous garantis rien, mais essayez de changer la ligne:

byte buffer[]=new byte[512*1024];

en (par exemple)

ByteBuffer buffer[]=new byte[512*1024];

Finalement il s'agissait de la définition du tableau, elle se faisait sur le "byte" directement

byte[] buffer=new byte[512*1024];

merci

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.