Skip to content

Commit 1317001

Browse files
garcia-jjlucascs
authored andcommitted
commons-io to guava
1 parent 17c93fd commit 1317001

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

vraptor-core/src/main/java/br/com/caelum/vraptor/interceptor/download/InputStreamDownload.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import javax.servlet.http.HttpServletResponse;
2525

26-
import org.apache.commons.io.IOUtils;
26+
import com.google.common.io.ByteStreams;
2727

2828
/**
2929
* Handles download by reading from a input stream byte by byte.
@@ -55,7 +55,7 @@ public void write(HttpServletResponse response) throws IOException {
5555
writeDetails(response);
5656

5757
OutputStream out = response.getOutputStream();
58-
IOUtils.copy(stream, out);
58+
ByteStreams.copy(stream, out);
5959
}
6060

6161
void writeDetails(HttpServletResponse response) {

vraptor-core/src/main/java/br/com/caelum/vraptor/view/DefaultHttpResult.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
import javax.servlet.http.HttpServletResponse;
2727

28-
import org.apache.commons.io.IOUtils;
28+
import com.google.common.io.ByteStreams;
29+
import com.google.common.io.CharStreams;
2930

3031
/**
3132
* Implementation that delegates to HttpServletResponse
@@ -98,7 +99,7 @@ public HttpResult body(String body) {
9899

99100
public HttpResult body(InputStream body) {
100101
try {
101-
IOUtils.copy(body, response.getOutputStream());
102+
ByteStreams.copy(body, response.getOutputStream());
102103
} catch (IOException e) {
103104
throw new ResultException("Couldn't write to response body", e);
104105
}
@@ -107,7 +108,7 @@ public HttpResult body(InputStream body) {
107108

108109
public HttpResult body(Reader body) {
109110
try {
110-
IOUtils.copy(body, response.getWriter());
111+
CharStreams.copy(body, response.getWriter());
111112
} catch (IOException e) {
112113
throw new ResultException("Couldn't write to response body", e);
113114
}

0 commit comments

Comments
 (0)