Skip to content

Commit e221bd5

Browse files
committed
Removed use of apache io library
1 parent c6f17ca commit e221bd5

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

biojava-core/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
<artifactId>junit</artifactId>
4545
<scope>test</scope>
4646
</dependency>
47-
<dependency>
48-
<groupId>org.apache.commons</groupId>
49-
<artifactId>commons-io</artifactId>
50-
<version>1.3.2</version>
51-
</dependency>
5247
<!-- logging dependencies (managed by parent pom, don't set versions or scopes here) -->
5348
<dependency>
5449
<groupId>org.slf4j</groupId>

biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
package org.biojava.nbio.core.sequence.loader;
2222

23-
import org.apache.commons.io.IOUtils;
2423
import org.biojava.nbio.core.exceptions.CompoundNotFoundException;
2524
import org.biojava.nbio.core.sequence.ProteinSequence;
2625
import org.biojava.nbio.core.sequence.compound.AminoAcidCompound;
@@ -79,7 +78,7 @@ public static Collection<String[]> getExamples() {
7978

8079
/**
8180
* 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
8382
* directory avoids calling out to the server and hitting a 429 status code from the server which fails the build.
8483
* @throws IOException
8584
*/
@@ -107,11 +106,21 @@ private void copyTestFileToWorkingDirectory(String filename) throws IOException
107106
String dest = destRoot + filename;
108107
String src = "org/biojava/nbio/core/sequence/GenbankProxySequenceReader/" + filename;
109108

109+
//Remove any pre-existing files
110+
File d = new File(dest);
111+
d.delete();
112+
110113
FileOutputStream destination = new FileOutputStream(new File(dest));
111114
InputStream source = this.getClass().getClassLoader().getResourceAsStream(src);
112115

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+
}
114122

123+
destination.flush();
115124
destination.close();
116125
source.close();
117126
}

0 commit comments

Comments
 (0)