0

所以我有这个文件:

    ------------splitter------------ 
classname: test
class: testing
description: this is a test
------------splitter------------ 
classname: test1
class: testing1
description: this is a test1
------------splitter------------ 
classname: test2
class: testing2
description: this is a test2

我正在阅读这个文件,内容如下:

try {
            final FileInputStream fis = new FileInputStream("class.file");
            BufferedReader b = new BufferedReader(new InputStreamReader(fis));
            String line;
            while ((line = b.readLine()) != null) {
                String[] split = line.split("------------splitter------------");
   }
        }  catch (Exception e) {
        }

我将如何获得所有行的内容,例如类名、类和描述?我试过 split[0] ,它只返回整个代码(没有 ---splitter---)。

4

0 回答 0