1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.maven.wagon; |
17 |
|
|
18 |
|
import java.io.File; |
19 |
|
import java.io.FileInputStream; |
20 |
|
import java.io.FileNotFoundException; |
21 |
|
import java.io.IOException; |
22 |
|
|
23 |
|
|
24 |
|
@link |
25 |
|
|
26 |
|
@author |
27 |
|
@since |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.42 |
|
29 |
|
public class TransferProgressFileInputStream extends FileInputStream { |
30 |
|
|
31 |
|
private TransferProgress progress; |
32 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
33 |
0
|
public TransferProgressFileInputStream(File file, TransferProgress progress) throws FileNotFoundException {... |
34 |
0
|
super(file); |
35 |
0
|
this.progress = progress; |
36 |
|
} |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
38 |
0
|
public int read() throws IOException {... |
39 |
0
|
int b = super.read(); |
40 |
0
|
if (b != -1) { |
41 |
0
|
progress.notify(new byte[] { (byte) b }, 1); |
42 |
|
} |
43 |
0
|
return b; |
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
46 |
0
|
public int read(byte b[]) throws IOException {... |
47 |
0
|
int length = super.read(b); |
48 |
0
|
if (length != -1) { |
49 |
0
|
progress.notify(b, length); |
50 |
|
} |
51 |
0
|
return length; |
52 |
|
} |
53 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
54 |
0
|
public int read(byte b[], int off, int len) throws IOException {... |
55 |
0
|
int count = super.read(b, off, len); |
56 |
0
|
if (count == -1) { |
57 |
0
|
return count; |
58 |
|
} |
59 |
0
|
if (off == 0) { |
60 |
0
|
progress.notify(b, count); |
61 |
|
} else { |
62 |
0
|
byte[] bytes = new byte[len]; |
63 |
0
|
System.arraycopy(b, off, bytes, 0, count); |
64 |
0
|
progress.notify(bytes, count); |
65 |
|
} |
66 |
0
|
return count; |
67 |
|
} |
68 |
|
} |