8192 bytes when creating the file

In my Java code, I have a function that receives a file from a client in an HTTP request and converts it to a file. I have this line:

byte[] buffer = new byte[8192];

What does 8192 bytes (8 kb) mean?

This is one of the answers that I have , and want me to understand this code.

+5
source share
4 answers

That it uses a buffer to read and write 8kB blocks at once. The number is pretty arbitrary, but for performance reasons it makes sense to use a few 512 bytes when writing a file and, preferably, a multiple of the size of a disk cluster. 8kB is a reasonable buffer size for most purposes.

+10
source

, , 8192 .

+2

8192 - . char [8192];/* 8192 */ 512 .

+2

, , . , 8k , 8k , .

+1

All Articles