In my Java code I have function that gets file from the client in http request and converts that in to the file. I have this line there:
byte[] buffer = new byte[8192];
what does 8192 bytes (8 kb) means here?
This is one of the responses that I got, and want to make sure that I understand that code.
That it uses a buffer to read and write 8kB blocks at once. The number is fairly arbitary, but for performance reasons it makes sense to use a multiple of 512 bytes when writing a file, and preferably a multiple of the disks cluster size. 8kB is a reasonable buffer size for most purposes.
8192 is maximum size of a package sending via network. char buffer[8192]; /* single packets are usually not bigger than 8192 bytes */ 512 bytes is too small.
This is the size of the array of bytes, meaning that your buffer will hold 8192 bytes at a time.
If I had to guess, that is the amount of space you are using to read in the file. Without the rest of the code I can't tell if it is trying to read it all and cram it into 8k or if it is reading it in, 8k at a time, and then dumping it into the file.