1 |
|
package org.apache.torque.mojo; |
2 |
|
|
3 |
|
import java.io.File; |
4 |
|
import java.io.FileInputStream; |
5 |
|
import java.io.FileOutputStream; |
6 |
|
import java.io.InputStream; |
7 |
|
import java.io.OutputStream; |
8 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.2 |
|
9 |
|
public class Tail { |
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 3 |
Complexity Density: 0.2 |
|
10 |
0
|
public static void main(String[] args) {... |
11 |
0
|
try { |
12 |
0
|
int display = 3 * 1024; |
13 |
0
|
String filename = "C:/temp/old.xml"; |
14 |
0
|
File file = new File(filename); |
15 |
0
|
long length = file.length(); |
16 |
0
|
InputStream in = new FileInputStream(file); |
17 |
0
|
in.skip(length - display); |
18 |
0
|
OutputStream out = new FileOutputStream("C:/temp/tail.txt"); |
19 |
0
|
byte[] buffer = new byte[1024]; |
20 |
0
|
int readLength = 0; |
21 |
0
|
while ((readLength = in.read(buffer, 0, buffer.length)) != -1) { |
22 |
0
|
out.write(buffer, 0, readLength); |
23 |
|
} |
24 |
0
|
in.close(); |
25 |
0
|
out.close(); |
26 |
|
} catch (Throwable t) { |
27 |
0
|
t.printStackTrace(); |
28 |
|
} |
29 |
|
} |
30 |
|
|
31 |
|
} |