Ignore:
Timestamp:
2016-01-03T16:30:55+01:00 (4 years ago)
Author:
Don-vip
Message:

improve performance and simplify file copy operations (major performance gain when downloading geotools plugin)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r9274 r9280  
    2323import java.io.InputStream;
    2424import java.io.InputStreamReader;
    25 import java.io.OutputStream;
    2625import java.io.UnsupportedEncodingException;
    2726import java.net.HttpURLConnection;
     
    435434
    436435    /**
    437      * Copy data from source stream to output stream.
    438      * @param source source stream
    439      * @param destination target stream
    440      * @return number of bytes copied
    441      * @throws IOException if any I/O error occurs
    442      */
    443     public static int copyStream(InputStream source, OutputStream destination) throws IOException {
    444         int count = 0;
    445         byte[] b = new byte[512];
    446         int read;
    447         while ((read = source.read(b)) != -1) {
    448             count += read;
    449             destination.write(b, 0, read);
    450         }
    451         return count;
    452     }
    453 
    454     /**
    455436     * Deletes a directory recursively.
    456437     * @param path The directory to delete
Note: See TracChangeset for help on using the changeset viewer.