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 @@ -68,7 +68,7 @@ public boolean createNewFile() throws IOException{
6868 return fileSource .createNewFile ();
6969 }
7070 public boolean createNewFile (InputStream input ) throws IOException {
71- fromBytes ( SpecificImplementation . GXutil . toByteArray ( input ) );
71+ fromInputStream ( input );
7272 return true ;
7373 }
7474 public boolean delete (){
@@ -180,6 +180,16 @@ public void fromBytes(byte[] data) throws IOException
180180 destination .write (data , 0 , data .length );
181181 }
182182 }
183+ private void fromInputStream (InputStream input ) throws IOException
184+ {
185+ try (OutputStream output = new BufferedOutputStream (new FileOutputStream (fileSource ))) {
186+ byte [] buffer = new byte [8192 ];
187+ int bytesRead ;
188+ while ((bytesRead = input .read (buffer )) != -1 ) {
189+ output .write (buffer , 0 , bytesRead );
190+ }
191+ }
192+ }
183193 public String readAllText (String encoding )throws IOException {
184194 return SpecificImplementation .FileUtils .readFileToString (fileSource , CommonUtil .normalizeEncodingName (encoding ));
185195 }
You can’t perform that action at this time.
0 commit comments