我试图text/plain通过互联网逐行读取文件.我现在的代码是:
URL url = new URL("http://kuehldesign.net/test.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
LinkedList<String> lines = new LinkedList();
String readLine;
while ((readLine = in.readLine()) != null) {
lines.add(readLine);
}
for (String line : lines) {
out.println("> " + line);
}
Run Code Online (Sandbox Code Playgroud)
该文件test.txt包含¡Hélló!,我正在使用它来测试编码.
当我查看OutputStream(out)时,我将其视为> ¬°H?©ll??!.我不相信这是一个问题,OutputStream因为我可以out.println("é");没有问题.
阅读的任何想法都形成InputStreamUTF-8?谢谢!