|
20 | 20 | */ |
21 | 21 | package org.biojava.nbio.core.sequence.loader; |
22 | 22 |
|
23 | | -import org.apache.commons.io.IOUtils; |
24 | 23 | import org.biojava.nbio.core.exceptions.CompoundNotFoundException; |
25 | 24 | import org.biojava.nbio.core.sequence.ProteinSequence; |
26 | 25 | import org.biojava.nbio.core.sequence.compound.AminoAcidCompound; |
@@ -79,7 +78,7 @@ public static Collection<String[]> getExamples() { |
79 | 78 |
|
80 | 79 | /** |
81 | 80 | * In {@link GenbankProxySequenceReader} there is a check to see if the requested files are already in the temp |
82 | | - * directory before attemting to retrieve them from the remote server. so simply copying the test files to the temp |
| 81 | + * directory before attempting to retrieve them from the remote server. so simply copying the test files to the temp |
83 | 82 | * directory avoids calling out to the server and hitting a 429 status code from the server which fails the build. |
84 | 83 | * @throws IOException |
85 | 84 | */ |
@@ -107,11 +106,21 @@ private void copyTestFileToWorkingDirectory(String filename) throws IOException |
107 | 106 | String dest = destRoot + filename; |
108 | 107 | String src = "org/biojava/nbio/core/sequence/GenbankProxySequenceReader/" + filename; |
109 | 108 |
|
| 109 | + //Remove any pre-existing files |
| 110 | + File d = new File(dest); |
| 111 | + d.delete(); |
| 112 | + |
110 | 113 | FileOutputStream destination = new FileOutputStream(new File(dest)); |
111 | 114 | InputStream source = this.getClass().getClassLoader().getResourceAsStream(src); |
112 | 115 |
|
113 | | - IOUtils.copy(source, destination); |
| 116 | +a int read; |
| 117 | + byte[] buffer = new byte[1024]; |
| 118 | + |
| 119 | + while((read = source.read(buffer)) > 0){ |
| 120 | + destination.write(buffer, 0, read); |
| 121 | + } |
114 | 122 |
|
| 123 | + destination.flush(); |
115 | 124 | destination.close(); |
116 | 125 | source.close(); |
117 | 126 | } |
|
0 commit comments