svn commit: r493931 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r493931 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java

jaz-3
Author: jaz
Date: Sun Jan  7 19:48:23 2007
New Revision: 493931

URL: http://svn.apache.org/viewvc?view=rev&rev=493931
Log:
added quick method to obtain an outputstream

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java?view=diff&rev=493931&r1=493930&r2=493931
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java Sun Jan  7 19:48:23 2007
@@ -15,14 +15,7 @@
  */
 package org.ofbiz.base.util;
 
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.BufferedReader;
+import java.io.*;
 
 /**
  * File Utilities
@@ -54,7 +47,7 @@
             }
         }
     }
-
+        
     public static Writer getBufferedWriter(String path, String name) throws IOException {
         String fileName = getPatchedFileName(path, name);
         if (UtilValidate.isEmpty(fileName)) {
@@ -62,6 +55,15 @@
         }
 
         return new BufferedWriter(new FileWriter(fileName));
+    }
+
+    public static OutputStream getBufferedOutputStream(String path, String name) throws IOException {
+        String fileName = getPatchedFileName(path, name);
+        if (UtilValidate.isEmpty(fileName)) {
+            throw new IOException("Cannot obtain buffered writer for an empty filename!");
+        }
+
+        return new BufferedOutputStream(new FileOutputStream(fileName));
     }
 
     public static String getPatchedFileName(String path, String fileName) throws IOException {