私はテキストファイルを読み込もうとしています.fileImputStreamを使用しています.すべての行を単一の文字列に読み込んでからコンソールに出力します(System.out)
humanSerf.txt を読み取ろうとすると、コンソールに次のように表示されます。
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\f0\fs24 \cf0 symbol=HS\
strength=15\
agility=13\
constitution=7\
wisdom=9\
intelligence=5}
テキストファイルには、次のように書かれています。
symbol=HS
strength=15
agility=13
constitution=7
wisdom=9
intelligence=5
奇妙なテキストを非表示にするにはどうすればよいですか?
これは私が使用しているコードです、助けてください
try{
// Open the file that is the first
// command line parameter
FileInputStream read = new FileInputStream("resources/monsters/human/humanSerf.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(read);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
}
//Close the input stream
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
奇妙なテキストを非表示にするにはどうすればよいですか? ps、これは mac の textedditor で行われました