1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.internal.test.util;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.nio.file.Files;
24 import java.nio.file.Path;
25 import java.nio.file.attribute.FileTime;
26
27 import org.eclipse.aether.spi.io.PathProcessor;
28
29
30
31
32 public class TestPathProcessor implements PathProcessor {
33
34 private final TestFileProcessor testFileProcessor = new TestFileProcessor();
35
36 @Override
37 public void setLastModified(Path path, long value) throws IOException {
38 Files.setLastModifiedTime(path, FileTime.fromMillis(value));
39 }
40
41 public void mkdirs(Path directory) {
42 if (directory == null) {
43 return;
44 }
45 testFileProcessor.mkdirs(directory.toFile());
46 }
47
48 public void write(Path file, String data) throws IOException {
49 testFileProcessor.write(file.toFile(), data);
50 }
51
52 public void write(Path target, InputStream source) throws IOException {
53 testFileProcessor.write(target.toFile(), source);
54 }
55
56 public long copy(Path source, Path target, ProgressListener listener) throws IOException {
57 return testFileProcessor.copy(source.toFile(), target.toFile(), null);
58 }
59
60 public void move(Path source, Path target) throws IOException {
61 testFileProcessor.move(source.toFile(), target.toFile());
62 }
63 }