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{
54
54
return fileSource .createNewFile ();
55
55
}
56
56
public boolean createNewFile (InputStream input ) throws IOException {
57
- fromBytes ( SpecificImplementation . GXutil . toByteArray ( input ) );
57
+ fromInputStream ( input );
58
58
return true ;
59
59
}
60
60
public boolean delete (){
@@ -155,6 +155,16 @@ public void fromBytes(byte[] data) throws IOException
155
155
destination .write (data , 0 , data .length );
156
156
}
157
157
}
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
+ }
158
168
public String readAllText (String encoding )throws IOException {
159
169
return SpecificImplementation .FileUtils .readFileToString (fileSource , CommonUtil .normalizeEncodingName (encoding ));
160
170
}
You can’t perform that action at this time.
0 commit comments