Is there any way to get the size in bytes of a string in Java?

前端 未结 5 742
旧巷少年郎
旧巷少年郎 2021-01-21 19:20

I need the size in bytes of each line in a file, so I can get a percentage of the file read. I already got the size of the file with file.length(), but how do I get

5条回答
  •  囚心锁ツ
    2021-01-21 19:57

    If the File is an ASCII file, then you can use String.length(); otheriwse it gets more complex.

提交回复
热议问题