示例#1
0
 public void save(int unpatchedPosition, int patchedPositon, AddLine line)
     throws FaileSaveException {
   //		android.util.Log.v("kiyo","save add #A#"+unpatchedPosition +","+ patchedPositon +"," +
   // line);
   int start = mPrevUnpatchedPosition + line.begin();
   // unpatchedPosition + line.begin();
   // int end = start + line.length();
   try {
     long beginPointer = 0;
     long endPointer = 0;
     if (start < mTarget.getNumberOfStockedElement()) {
       KyoroString insertedLine = mTarget.get(start);
       beginPointer = insertedLine.getBeginPointer();
       endPointer = insertedLine.getEndPointer();
     } else {
       KyoroString insertedLine = mTarget.get(mTarget.getNumberOfStockedElement() - 1);
       beginPointer = insertedLine.getEndPointer();
       endPointer = insertedLine.getEndPointer();
     }
     //			android.util.Log.v("kiyo","save add #B-1#");
     //			for (int lineLocation = 0; lineLocation < end; lineLocation++) {
     for (int lineLocation = 0; lineLocation < line.length(); lineLocation++) {
       String encodedData =
           encodeAddLine(beginPointer, endPointer, line.get(lineLocation).toString());
       mVFile.addChunk(encodedData.getBytes("utf8"));
     }
     //			android.util.Log.v("kiyo","save add #B-2#");
   } catch (Exception e) {
     e.printStackTrace();
     throw new FaileSaveException();
   }
   //		android.util.Log.v("kiyo","save add #C#");
 }
示例#2
0
  public void save(int unpatchedPosition, int patchedPositon, DeleteLine line)
      throws FaileSaveException {
    int start = mPrevUnpatchedPosition + line.begin();
    int end = start + line.length();
    try {
      for (int location = start; location < end; location++) {
        KyoroString deletedLine = mTarget.get(location);
        long beginPointer = deletedLine.getBeginPointer();
        long endPointer = deletedLine.getEndPointer();
        //				android.util.Log.v("kiyo","location:"+location+","
        //						+beginPointer+","+endPointer+","+deletedLine);

        String encodedData = encodeDeleteLine(beginPointer, endPointer);
        mVFile.addChunk(encodedData.getBytes("utf8"));
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new FaileSaveException();
    }
  }