I have two byte arrays which I have put in an array list.The Code for which is here:
ArrayList al = new ArrayList();
FileInputStream fis=new FileInputStream(bin);
fis.read(file, 0, 2048);
metas="123456789123";
meta=metas.getBytes();
al.add(meta);
al.add(file);
But when I try to put it in an output stream like this fos.write(al.toArray());
It gives the error As
no suitable method found for write(Object[]) method FileOutputStream.write(byte[],int,int) is not applicable
what may be the problem
fis.read(...)not necesarily reads all 2k data intofile(I guess file is an array). It reads what it has available. You must call read repeteadely until 2k is readed, or until read returns<=0(end of file). It's not generating the problem you have, but will be an issue later.