File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
core/src/main/java/oracle/weblogic/deploy/util Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 7
7
import java .io .ByteArrayOutputStream ;
8
8
import java .io .File ;
9
9
import java .io .FileInputStream ;
10
+ import java .io .FileOutputStream ;
10
11
import java .io .FilenameFilter ;
11
12
import java .io .IOException ;
12
13
import java .io .InputStream ;
@@ -593,6 +594,24 @@ public static byte[] readInputStreamToByteArray(InputStream input) throws IOExce
593
594
return outputStream .toByteArray ();
594
595
}
595
596
597
+ public static File writeInputStreamToFile (InputStream input , String fileName ) throws IOException {
598
+ FileOutputStream fos = null ;
599
+ File file = null ;
600
+
601
+ try {
602
+ File tmpdir = new File (System .getProperty ("java.io.tmpdir" ));
603
+ file = new File (tmpdir , fileName );
604
+ byte [] byteArray = FileUtils .readInputStreamToByteArray (input );
605
+ fos = new FileOutputStream (file );
606
+ fos .write (byteArray );
607
+ }
608
+ finally {
609
+ if (fos != null ) { fos .close (); }
610
+ }
611
+
612
+ return file ;
613
+ }
614
+
596
615
///////////////////////////////////////////////////////////////////////////
597
616
// Private helper methods //
598
617
///////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments