Some changes to enable SPECjbb for MGC version. Enable the compilation for 1. class...
[IRC.git] / Robust / src / ClassLibrary / String.java
index 52147045afce4e7c0cbcc7479784b9da30c5ed39..e306e742c7798a482c34ddce1e938806bad1eeca 100644 (file)
@@ -41,6 +41,29 @@ public class String {
     this.count=length;
     this.offset=0;
   }
+  
+  public String(byte str[], String encoding) {
+    int length = this.count;
+    if (length>(str.length))
+      length=str.length;
+    char charstr[]=new char[length];
+    for(int i=0; i<length; i++)
+      charstr[i]=(char)str[i];
+    this.value=charstr;
+    this.count=length;
+    this.offset=0;
+  }
+  
+  public String(char str[], int offset, int length) {
+    if (length>(str.length-offset))
+      length=str.length-offset;
+    char charstr[]=new char[length];
+    for(int i=0; i<length; i++)
+      charstr[i]=str[i+offset];
+    this.value=charstr;
+    this.count=length;
+    this.offset=0;
+  }
 
   public String(String str) {
     this.value=str.value;
@@ -228,6 +251,19 @@ public class String {
       str[i]=(byte)value[i+offset];
     return str;
   }
+  
+  public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
+    if((srcBegin < 0) || (srcEnd > count) || (srcBegin > srcEnd)) {
+      // FIXME
+      System.printString("Index error: "+srcBegin+" "+srcEnd+" "+count+"\n"+this);
+      System.exit(-1);
+    }
+    int len = srcEnd - srcBegin;
+    int j = dstBegin;
+    for(int i=srcBegin; i<srcEnd; i++)
+      dst[j++]=value[i+offset];
+    return;
+  }
 
   public int length() {
     return count;