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{
68
68
return fileSource .createNewFile ();
69
69
}
70
70
public boolean createNewFile (InputStream input ) throws IOException {
71
- fromBytes ( SpecificImplementation . GXutil . toByteArray ( input ) );
71
+ fromInputStream ( input );
72
72
return true ;
73
73
}
74
74
public boolean delete (){
@@ -180,6 +180,16 @@ public void fromBytes(byte[] data) throws IOException
180
180
destination .write (data , 0 , data .length );
181
181
}
182
182
}
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
+ }
183
193
public String readAllText (String encoding )throws IOException {
184
194
return SpecificImplementation .FileUtils .readFileToString (fileSource , CommonUtil .normalizeEncodingName (encoding ));
185
195
}
You can’t perform that action at this time.
0 commit comments