// assume file contents are in a string buffer;
// did not try under compiler, might have some errors
String buf = ...;
String[] half  = new String[]{"A",",",".",...};
String[] whole = new String[]{"\uxxxx","\uyyyy",...};for(int i = 0; i < half.length; i++) {
   String oldS = half[i];
   String newS = whole[i];
   int prevIdx = 0; curIdx= 0;
   StringBuffer result= new StringBuffer();
   while((curIdx=buf.indexOf(oldS,prevIdx)) != -1){
      result.append(buf.substring(prevIdx,curIdx)+newS);
      preIdx = curIdx+oldS.size();
   }
   if(result != 0)
      buf = result.toString();
}