I am trying to read a certain ammount of bytes from a file and write it to anouther file. The certain amount of bytes in not always the same. Here the number of bytes is stored in NewSize which is a long. The name of the new file is in Name, string. An error occurs saying '.class' is expected and point to buffer[] on this line:

c = in.read(buffer[], y, (int) NewSize - 1);

It seems to think buffer[] is a class??

Also the compiler does not like anything to do with the out, out.close() expects an extra ')' at the end, the out.write(buffer[].length); causes a 'cannot resolve symbol?

--------
int x, c;
int y = 0;
byte buffer[];

//All this is in a try/catch

InputStream in = new FileInputStream(FilePath);
c = in.read(buffer[], y, (int) NewSize - 1);
if (c != -1) {
OutputStream out = new FileOutputStream(Name);
out.write(buffer[].length);
out.close();
}