|
1 |
| package com.agical.rdoc.core.converter.impl; |
|
2 |
| |
|
3 |
| import java.io.IOException; |
|
4 |
| import java.io.InputStream; |
|
5 |
| import java.io.OutputStream; |
|
6 |
| |
|
7 |
| import com.agical.rdoc.core.converter.ObjectConverter; |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| public class InputStreamObjectConverter implements ObjectConverter { |
|
15 |
| |
|
16 |
1
| public InputStreamObjectConverter() {
|
|
17 |
1
| super();
|
|
18 |
| } |
|
19 |
| |
|
20 |
1
| public void convert(Object object, OutputStream target) throws IOException {
|
|
21 |
1
| InputStream inputStream = (InputStream) object;
|
|
22 |
1
| byte[] bs = new byte[1024];
|
|
23 |
1
| int read = 0;
|
|
24 |
?
| while( (read = inputStream.read(bs)) != -1 ){
|
|
25 |
1
| target.write(bs, 0, read);
|
|
26 |
| } |
|
27 |
| } |
|
28 |
| |
|
29 |
| } |