Changeset 9491 in josm for trunk


Ignore:
Timestamp:
2016-01-16T18:31:07+01:00 (9 years ago)
Author:
Don-vip
Message:

see #12356 - remove use of internal proprietary API (patch by michael2402)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java

    r9458 r9491  
    55
    66import java.io.ByteArrayInputStream;
     7import java.io.ByteArrayOutputStream;
    78import java.io.File;
    89import java.io.FileInputStream;
     
    1819import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
    1920import org.openstreetmap.josm.data.osm.DataSet;
    20 
    21 import sun.misc.IOUtils;
    2221
    2322/**
     
    8180        File file = new File(DATA_FILE);
    8281        try (InputStream is = decompressBeforeRead ? Compression.getUncompressedFileInputStream(file) : new FileInputStream(file)) {
    83             return new ByteArrayInputStream(IOUtils.readFully(is, -1, false));
     82            ByteArrayOutputStream temporary = new ByteArrayOutputStream();
     83            byte[] readBuffer = new byte[4096];
     84            int readBytes = 0;
     85            while (readBytes != -1) {
     86                temporary.write(readBuffer, 0, readBytes);
     87                readBytes = is.read(readBuffer);
     88            }
     89            return new ByteArrayInputStream(temporary.toByteArray());
    8490        }
    8591    }
Note: See TracChangeset for help on using the changeset viewer.