I'm trying to create a backup program to use. I can backup small files, but as soon as I try to backup any big files I get an ArrayIndexOutOfBoundsException.
FileOutputStream fos = new FileOutputStream(dp.getPath() + ".jbackup");
byte[] buffer = new byte[4096];
int fileSize = (int)f.length();
int read = 0;
int remaining = fileSize;
while((read = dis.read(buffer, 0, Math.min(buffer.length, remaining))) > 0) {
remaining -= read;
fos.write(buffer, 0, read);
}
Any suggestions?