File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
common/src/main/java/com/genexus/util Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public boolean createNewFile() throws IOException{
5454 return fileSource .createNewFile ();
5555 }
5656 public boolean createNewFile (InputStream input ) throws IOException {
57- fromBytes ( SpecificImplementation . GXutil . toByteArray ( input ) );
57+ fromInputStream ( input );
5858 return true ;
5959 }
6060 public boolean delete (){
@@ -155,6 +155,16 @@ public void fromBytes(byte[] data) throws IOException
155155 destination .write (data , 0 , data .length );
156156 }
157157 }
158+ private void fromInputStream (InputStream input ) throws IOException
159+ {
160+ try (OutputStream output = new BufferedOutputStream (new FileOutputStream (fileSource ))) {
161+ byte [] buffer = new byte [8192 ];
162+ int bytesRead ;
163+ while ((bytesRead = input .read (buffer )) != -1 ) {
164+ output .write (buffer , 0 , bytesRead );
165+ }
166+ }
167+ }
158168 public String readAllText (String encoding )throws IOException {
159169 return SpecificImplementation .FileUtils .readFileToString (fileSource , CommonUtil .normalizeEncodingName (encoding ));
160170 }
You can’t perform that action at this time.
0 commit comments