mercredi 29 avril 2015

What is concept of write files with bytes in java? [on hold]

I know that when I want to write a file, I should use code like this:

InputStream inputStream = new BufferedInputStream(url.openStream());
OutputStream outputStream = new FileOutputStream("/sdcard/myfile.jpg");

byte Data[] = new byte[1024];
long total = 0;

while ((count=inputStream.read(Data)) != -1) {
    total = total+count;
    outputStream.write(Data,0,count);
}

But I can't understand what happens with that result, is it writing an image file from zero to 100?

Can anyone describe for me how this occurred? Thanks

Aucun commentaire:

Enregistrer un commentaire