J
Joseph
hi, I just began with studying java and have a question about reading
bytes from file(fileA).Every time I make it read into a byte array with
size 256.I used a while loop to see whether the next byte is a -1,if it
is then stop .
int c,j=0;
mByteData=new byte[256];
while ((c=mByteSource.read())!= -1&&j<256){
mByteData[j]=(byte)c;
j++;
}
Q1: what is the second array like if the file size is 270kb ?(first 14
are bytes from file and rest are null ? or empty ? or zero ?)
Q2 : if I copy the array byte after byte using a for loop like
byte[] b2=new byte[256];
for(int i=0;i<256;i++){
b2=b1;
}
how can I write bytes to fileB and make fileA and fileB identical?
(MD5 sum)
because every time I found from 14th byte all the rest bytes
are all zeros ,there is no -1 and I do not know where to stop if I
want to write them to fileB.
Am I clear enough ?
bytes from file(fileA).Every time I make it read into a byte array with
size 256.I used a while loop to see whether the next byte is a -1,if it
is then stop .
int c,j=0;
mByteData=new byte[256];
while ((c=mByteSource.read())!= -1&&j<256){
mByteData[j]=(byte)c;
j++;
}
Q1: what is the second array like if the file size is 270kb ?(first 14
are bytes from file and rest are null ? or empty ? or zero ?)
Q2 : if I copy the array byte after byte using a for loop like
byte[] b2=new byte[256];
for(int i=0;i<256;i++){
b2=b1;
}
how can I write bytes to fileB and make fileA and fileB identical?
(MD5 sum)
because every time I found from 14th byte all the rest bytes
are all zeros ,there is no -1 and I do not know where to stop if I
want to write them to fileB.
Am I clear enough ?