replaced some gnu RE's with the much faster jakarta ORO
[mir.git] / source / mir / util / FileRoutines.java
index 32a964a..d42ab16 100755 (executable)
@@ -241,8 +241,8 @@ public class FileRoutines {
   /**
    * Reads the content of a file into an array of bytes
    */
-  public static byte[] readFileIntoByteArray(String fileName) throws IOException {
-    InputStream input = new FileInputStream(fileName);
+  public static byte[] readFileIntoByteArray(File aFile) throws IOException {
+    InputStream input = new FileInputStream(aFile);
     ByteArrayOutputStream result = new ByteArrayOutputStream();
 
     IORoutines.copyStream(input, result);
@@ -250,6 +250,28 @@ public class FileRoutines {
     return result.toByteArray();
   }
 
+       /**
+        * Reads the content of a file into an array of bytes
+        */
+       public static void writeByteArrayIntoFile(byte[] anArray, File aFile) throws IOException {
+         OutputStream output = new FileOutputStream(aFile);
+
+         try {
+               ByteArrayInputStream input = new ByteArrayInputStream(anArray);
+               try {
+                 IORoutines.copyStream(input, output);
+               }
+               finally {
+                       input.close();
+               }
+         }
+         finally {
+               output.close();
+         }
+       }
+
+
+
   /**
    * Creates all parent directories of a file if they do not exist
    */