我有一个java程序,它通过HTTP将结果(如控制台中所示)发送到浏览器。选项卡和换行符可以很好地格式化实际结果,如下所示:
./src/yse4 : The YSE emulator in use
[-w] - [w]rap around at tracefile end and begin anew at time zero.
[-f filename] - [-f tracefile to use from]
/home/Downloads/yse.wzt/tracefiles/capacity.3Mbps_400RTT_PER_0.0001.txt
File name: tracefiles/capacity.3Mbps_400RTT_PER_0.0001.txt
200 Forwarding Delay (ms)
200 Reversed Delay (ms)
3000000 Download Capacity (Mbps)
3000000 Upload Capacity (Mbps)
0.0001 Packet Error Rate (PER)
at=eth1
an=eth0
但是当我以HTML格式发送它时,它当然无法识别标签和换行符。我在每行末尾手动添加<br>
,但仍然缺少标签,浏览器会显示如下:
./src/yse4 : The YSE emulator in use
[-w] - [w]rap around at tracefile end and begin anew at time zero.
[-f filename] - [-f tracefile to use from]
/home/Downloads/yse.wzt/tracefiles/capacity.3Mbps_400RTT_PER_0.0001.txt
File name: tracefiles/capacity.3Mbps_400RTT_PER_0.0001.txt
200 Forwarding Delay (ms)
200 Reversed Delay (ms)
3000000 Download Capacity (Mbps)
3000000 Upload Capacity (Mbps)
0.0001 Packet Error Rate (PER)
at=eth1
an=eth0
如何将其格式化为HTML才能很好地看到?也许存在任何库?