[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Apr 18 15:58:08 UTC 2007


gordonp
Wed Apr 18 11:58:08 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services
In directory dev.open-bio.org:/tmp/cvs-serv12304/src/main/ca/ucalgary/seahawk/services

Modified Files:
	MobyComplexBuilder.java 
Log Message:
Fixed binary data replaceAll equivalent
moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyComplexBuilder.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java	2007/04/08 17:26:24	1.5
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyComplexBuilder.java	2007/04/18 15:58:08	1.6
@@ -206,22 +206,21 @@
 	for(int j = 0; j <= matcher.groupCount(); j++){
 	    // A replaceAll() for binary data
 	    if(data != null){
-		(new Exception("Binary replaceAll()")).printStackTrace();
 		int srcPos = 0;
-		for(int varIndex = result.indexOf("\\$"+j, srcPos); 
+		for(int varIndex = result.indexOf("$"+j, srcPos); 
 		    varIndex != -1; 
-		    varIndex = result.indexOf("\\$"+j, srcPos)){
-		    int varValueLength = matcher.end(j)-matcher.start(j)+1;
-		    
-		    byte[] newResultBytes = new byte[resultBytes.length+varValueLength];
-		    if(varIndex > 0){
+		    varIndex = result.indexOf("$"+j, srcPos)){
+		    int varValueLength = matcher.end(j)-matcher.start(j);
+		    int varLen = ("$"+j).getBytes().length;
+		    byte[] newResultBytes = new byte[resultBytes.length+varValueLength-varLen];
+		    if(varIndex > 0){			
 			System.arraycopy(resultBytes, 0, newResultBytes, 0, varIndex);
 		    }
 		    System.arraycopy(data, matcher.start(j), newResultBytes, varIndex, varValueLength);
-		    int remaining = result.length()-varIndex-2;
+		    int remaining = result.length()-varIndex-varLen;
 		    if(remaining > 0){
-			System.arraycopy(resultBytes, varIndex+2, newResultBytes, varIndex+varValueLength, 
-					 result.length()-varIndex-2);
+			System.arraycopy(resultBytes, varIndex+varLen, newResultBytes, varIndex+varValueLength, 
+					 result.length()-varIndex-varLen);
 		    }
 		    srcPos += varIndex + varValueLength + 1;
 		    resultBytes = newResultBytes;




More information about the MOBY-guts mailing list