| 1 |
|
package com.atlassian.core.spool; |
| 2 |
|
|
| 3 |
|
import java.io.BufferedInputStream; |
| 4 |
|
import java.io.BufferedOutputStream; |
| 5 |
|
import java.io.File; |
| 6 |
|
import java.io.FileOutputStream; |
| 7 |
|
import java.io.IOException; |
| 8 |
|
import java.io.InputStream; |
| 9 |
|
import java.io.OutputStream; |
| 10 |
|
|
| 11 |
|
import org.apache.commons.io.IOUtils; |
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
@see |
| 17 |
|
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 18 |
|
public class BufferedFileSpool implements FileSpool { |
| 19 |
|
|
| 20 |
|
private FileFactory fileFactory = DefaultSpoolFileFactory.getInstance(); |
| 21 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 22 |
0
|
public FileFactory getFileFactory()... |
| 23 |
|
{ |
| 24 |
0
|
return fileFactory; |
| 25 |
|
} |
| 26 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 27 |
0
|
public void setFileFactory(FileFactory fileFactory)... |
| 28 |
|
{ |
| 29 |
0
|
this.fileFactory = fileFactory; |
| 30 |
|
} |
| 31 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 32 |
1
|
public InputStream spool(InputStream is) throws IOException... |
| 33 |
|
{ |
| 34 |
1
|
File spoolFile = fileFactory.createNewFile(); |
| 35 |
|
|
| 36 |
1
|
OutputStream os = new BufferedOutputStream(new FileOutputStream(spoolFile)); |
| 37 |
1
|
IOUtils.copy(is, os); |
| 38 |
1
|
os.close(); |
| 39 |
|
|
| 40 |
1
|
return new BufferedInputStream(new SpoolFileInputStream(spoolFile)); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
} |