String buf = ...; // buf stores the content of the file
String a= "wo";
if(buf.indexOf(a) != -1) { // found
   int index = buf.indexOf(a)+a.length();
   System.out.println(buf.substring(index,index+1));
}else
   System.out.println("Can not find:"+a);
// 没有用编译器去调,大意如此)

解决方案 »

  1.   

    用for循环吧,算法和楼上的一样,用文件长度作为结束条件
      

  2.   

    find the place:index where wo sits. 
    The Chinese character should be at index+2, Its length is 1. 
    That's why we use buf.substring(index,index+1);
      

  3.   

    indexOfpublic int indexOf(String str)Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that: 
     this.startsWith(str, k)
    is true. Parameters:
    str - any string.
     
    Returns:
    if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned. Throws: 
    NullPointerException - if str is null.另外这个编码表你是用什么来做的?我觉得可以用哈希散列表。