| 1 |
|
package com.atlassian.core.spool; |
| 2 |
|
|
| 3 |
|
import java.io.IOException; |
| 4 |
|
import java.io.InputStream; |
| 5 |
|
import java.io.BufferedInputStream; |
| 6 |
|
|
| 7 |
|
import org.apache.commons.io.IOUtils; |
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 6 |
Complexity Density: 0.67 |
|
| 13 |
|
public class DeferredSpool implements FileSpool, ThresholdingSpool |
| 14 |
|
{ |
| 15 |
|
private int maxMemorySpool; |
| 16 |
|
private FileFactory fileFactory = DefaultSpoolFileFactory.getInstance(); |
| 17 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 18 |
0
|
public FileFactory getFileFactory()... |
| 19 |
|
{ |
| 20 |
0
|
return fileFactory; |
| 21 |
|
} |
| 22 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 23 |
0
|
public void setFileFactory(FileFactory fileFactory)... |
| 24 |
|
{ |
| 25 |
0
|
this.fileFactory = fileFactory; |
| 26 |
|
} |
| 27 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 28 |
0
|
public void setThresholdBytes(int bytes)... |
| 29 |
|
{ |
| 30 |
0
|
this.maxMemorySpool = bytes; |
| 31 |
|
} |
| 32 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 33 |
0
|
public int getThresholdBytes()... |
| 34 |
|
{ |
| 35 |
0
|
return maxMemorySpool; |
| 36 |
|
} |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 38 |
0
|
public InputStream spool(InputStream is) throws IOException... |
| 39 |
|
{ |
| 40 |
0
|
DeferredSpoolFileOutputStream deferredStream = getNewDeferredSpoolFileOutputStream(); |
| 41 |
0
|
IOUtils.copy(is, deferredStream); |
| 42 |
0
|
deferredStream.close(); |
| 43 |
0
|
return new BufferedInputStream(deferredStream.getInputStream()); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@return |
| 48 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 49 |
0
|
protected DeferredSpoolFileOutputStream getNewDeferredSpoolFileOutputStream()... |
| 50 |
|
{ |
| 51 |
0
|
return new DeferredSpoolFileOutputStream(maxMemorySpool, getFileFactory()); |
| 52 |
|
} |
| 53 |
|
} |