aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java
index 0126d29b3..14952a537 100644
--- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java
+++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java
@@ -11,6 +11,7 @@
* ******************************************************************/
package org.aspectj.testing;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
@@ -313,6 +314,22 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
ClassPath cp = new ClassPath(cpentry + File.pathSeparator + System.getProperty("java.class.path"));
return SyntheticRepository.getInstance(cp);
}
+
+ protected byte[] loadFileAsByteArray(File f) {
+ try {
+ byte[] bs = new byte[100000];
+ BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f));
+ int pos = 0;
+ int len = 0;
+ while ((len=bis.read(bs, pos, 100000-pos))!=-1) {
+ pos+=len;
+ }
+ bis.close();
+ return bs;
+ } catch (Exception e) {
+ return null;
+ }
+ }
public JavaClass getClassFrom(File where, String clazzname) throws ClassNotFoundException {
SyntheticRepository repos = createRepos(where);