Reading entire html file to String?

后端 未结 7 1065
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 09:56

Are there better ways to read an entire html file to a single string variable than:

    String content = \"\";
    try {
        BufferedReader in = new Buff         


        
7条回答
  •  温柔的废话
    2020-12-05 10:30

    For string operations use StringBuilder or StringBuffer classes for accumulating string data blocks. Do not use += operations for string objects. String class is immutable and you will produce a large amount of string objects upon runtime and it will affect on performance.

    Use .append() method of StringBuilder/StringBuffer class instance instead.

提交回复
热议问题