I am reading a CSV file, and there is a header in each cell block and information pertaining to each column of the headers.
When I read the file, I want to know the total size of the csv file, so in MB. For each String line
, which is more correct to use to know the overall size of the file (I will sum each line), line.getBytes().length
or line.length()*Character.BYTES
?
Using line.getBytes().length
gives me 841 while line.length()*Character.BYTES
gives me 1682. I haven't taken classes too depth on this knowledge so I am not particularly sure which one is correct for just general size on a csv file (like how it would show up in the size column of a MAC folder)
*I do need the size of each line as I will need to determine what to do with it depending on the size.