| 1 |
|
package com.atlassian.core.spool; |
| 2 |
|
|
| 3 |
|
import java.io.ByteArrayInputStream; |
| 4 |
|
import java.io.IOException; |
| 5 |
|
import java.io.InputStream; |
| 6 |
|
|
| 7 |
|
import org.apache.commons.io.IOUtils; |
| 8 |
|
import org.apache.commons.io.output.ByteArrayOutputStream; |
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
|
|
|
| 50% |
Uncovered Elements: 4 (8) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 14 |
|
public class ByteArraySpool implements Spool |
| 15 |
|
{ |
| 16 |
|
private int initialBufferSize = 10 * 1024; |
| 17 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 18 |
0
|
public int getInitialBufferSize()... |
| 19 |
|
{ |
| 20 |
0
|
return initialBufferSize; |
| 21 |
|
} |
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
@param |
| 27 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 28 |
0
|
public void setInitialBufferSize(int initialBufferSize)... |
| 29 |
|
{ |
| 30 |
0
|
this.initialBufferSize = initialBufferSize; |
| 31 |
|
} |
| 32 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 33 |
1
|
public InputStream spool(InputStream is) throws IOException... |
| 34 |
|
{ |
| 35 |
1
|
ByteArrayOutputStream buf = new ByteArrayOutputStream(initialBufferSize); |
| 36 |
1
|
IOUtils.copy(is, buf); |
| 37 |
1
|
return new ByteArrayInputStream(buf.toByteArray()); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
} |