How to read the file content into a variable in one go?

后端 未结 3 1817
甜味超标
甜味超标 2021-01-31 03:22

In Java, if you know for certain a file is very small, you can use readBytes() method to read the content in one go instead of read it line by line or using buffer.

3条回答
  •  既然无缘
    2021-01-31 04:01

    Process the lines inside the loop instead of after it. If you really need the file in a variable:

    var=$(

提交回复
热议问题