JAL-2349 JAL-3855 off by one and daft return
[jalview.git] / src / com / stevesoft / pat / wrap / RandomAccessFileWrap.java
index b4d38dc..fddfd4f 100755 (executable)
@@ -7,9 +7,14 @@
 //
 package com.stevesoft.pat.wrap;
 
-import java.io.*;
+import jalview.util.MessageManager;
 
-import com.stevesoft.pat.*;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.stevesoft.pat.BasicStringBufferLike;
+import com.stevesoft.pat.Regex;
+import com.stevesoft.pat.StringLike;
 
 /**
  * Provides a wrapper for a RandomAccessFile so that it can be searched by
@@ -58,6 +63,7 @@ public class RandomAccessFileWrap implements StringLike
     this.raf = raf;
   }
 
+  @Override
   public char charAt(int i)
   {
     if (i >= i0 && i < iend)
@@ -84,15 +90,19 @@ public class RandomAccessFileWrap implements StringLike
     {
     }
 
-    throw new ArrayIndexOutOfBoundsException("Out of bounds for file:"
-            + " i=" + i + ", Final Buffer: i0=" + i0 + " iend=" + iend);
+    throw new ArrayIndexOutOfBoundsException(MessageManager
+            .formatMessage("exception.out_of_bounds_for_file", new String[]
+            { Integer.valueOf(i).toString(), Integer.valueOf(i0).toString(),
+                Integer.valueOf(iend).toString() }));
   }
 
+  @Override
   public String toString()
   {
-    throw new Error("Not implemented");
+    throw new Error(MessageManager.getString("error.not_implemented"));
   }
 
+  @Override
   public int length()
   {
     try
@@ -109,6 +119,7 @@ public class RandomAccessFileWrap implements StringLike
     }
   }
 
+  @Override
   public String substring(int i1, int i2)
   {
     StringBuffer sb = new StringBuffer();
@@ -119,11 +130,18 @@ public class RandomAccessFileWrap implements StringLike
     return sb.toString();
   }
 
+  @Override
   public Object unwrap()
   {
     return raf;
   }
 
+  /**
+   * @j2sIgnore
+   * 
+   * @param files
+   * @throws IOException
+   */
   public static void main(String[] files) throws IOException
   {
     for (int i = 0; i < files.length; i++)
@@ -151,11 +169,13 @@ public class RandomAccessFileWrap implements StringLike
     }
   }
 
+  @Override
   public BasicStringBufferLike newStringBufferLike()
   {
     return new StringBufferWrap();
   }
 
+  @Override
   public int indexOf(char c)
   {
     for (int i = 0; i < length(); i++)