diff --git a/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java b/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java
index b13c15d..384b1c8 100644
|
a
|
b
|
package org.openstreetmap.josm.io;
|
| 4 | 4 | import static org.junit.Assert.assertNotNull; |
| 5 | 5 | |
| 6 | 6 | import java.io.ByteArrayInputStream; |
| | 7 | import java.io.ByteArrayOutputStream; |
| 7 | 8 | import java.io.File; |
| 8 | 9 | import java.io.FileInputStream; |
| 9 | 10 | import java.io.IOException; |
| … |
… |
import org.openstreetmap.josm.PerformanceTestUtils;
|
| 18 | 19 | import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; |
| 19 | 20 | import org.openstreetmap.josm.data.osm.DataSet; |
| 20 | 21 | |
| 21 | | import sun.misc.IOUtils; |
| 22 | | |
| 23 | 22 | /** |
| 24 | 23 | * This test tests how fast we are at reading an OSM file. |
| 25 | 24 | * <p> |
| … |
… |
public class OsmReaderPerformanceTest {
|
| 80 | 79 | private InputStream loadFile(boolean decompressBeforeRead) throws IOException { |
| 81 | 80 | File file = new File(DATA_FILE); |
| 82 | 81 | 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()); |
| 84 | 90 | } |
| 85 | 91 | } |
| 86 | 92 | } |