多谢

解决方案 »

  1.   

    FileInputStream fis = new FileInputStream("your file's path");
    DataInputStream dis = new DataInputStream(new BufferedReader(fis));
    String temp = dis.readLine();
    这样就可以读取文本中的一行。
    如果你是要解析文本的话,就这样:
    FileInputStream fis = new FileInputStream("your file's path");
    StringBuffer buf = new StringBuffer();
    int c;
    //read all the data in file. 
    while((c = fis.read()) != -1){
       buf.append((char) c);
    }
    //parse the String.
    String temp = buf.toString();
    String[] stringArray = temp.split("/r/n");大家一起想想更好的方法。。
      

  2.   

    String text="你的文本";
    String[] getline;
    int i=0;
    int j;
    int k=0;
    j=text.indexOf("\r\n");
    while(j>=0)
    {
        getline[k]=text.substring(i,j);
        i=j+2;
        j=text.indexOf("\r\n",i);
        k++}