Class TestPathProcessor
java.lang.Object
org.eclipse.aether.internal.test.util.TestPathProcessor
- All Implemented Interfaces:
PathProcessor
A simple file processor implementation to help satisfy component requirements during tests.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.aether.spi.io.PathProcessor
PathProcessor.ProgressListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcopy(Path source, Path target, PathProcessor.ProgressListener listener) Copies the specified source file to the given target file.voidvoidMoves the specified source file to the given target file.voidsetLastModified(Path path, long value) Sets last modified of path in milliseconds, if exists.voidwrite(Path target, InputStream source) Writes the given stream to a file.voidWrites the given data to a file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.aether.spi.io.PathProcessor
copy, copyWithTimestamp, lastModified, size
-
Constructor Details
-
TestPathProcessor
public TestPathProcessor()
-
-
Method Details
-
setLastModified
Description copied from interface:PathProcessorSets last modified of path in milliseconds, if exists.- Specified by:
setLastModifiedin interfacePathProcessor- Parameters:
path- The path, may benull.- Throws:
IOException- If an I/O error occurs. Some exceptions/reasons of failure to set mtime may be swallowed, and can be multiple, ranging from "file not found" to cases when FS does not support the setting the mtime.
-
mkdirs
-
write
Description copied from interface:PathProcessorWrites the given data to a file. UTF-8 is assumed as encoding for the data. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.- Specified by:
writein interfacePathProcessor- Parameters:
file- The file to write to, must not benull. This file will be overwritten.data- The data to write, may benull.- Throws:
IOException- If an I/O error occurs.
-
write
Description copied from interface:PathProcessorWrites the given stream to a file. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.- Specified by:
writein interfacePathProcessor- Parameters:
target- The file to write to, must not benull. This file will be overwritten.source- The stream to write to the file, must not benull.- Throws:
IOException- If an I/O error occurs.
-
copy
public long copy(Path source, Path target, PathProcessor.ProgressListener listener) throws IOException Description copied from interface:PathProcessorCopies the specified source file to the given target file. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.- Specified by:
copyin interfacePathProcessor- Parameters:
source- The file to copy from, must not benull.target- The file to copy to, must not benull.listener- The listener to notify about the copy progress, may benull.- Returns:
- The number of copied bytes.
- Throws:
IOException- If an I/O error occurs.
-
move
Description copied from interface:PathProcessorMoves the specified source file to the given target file. If the target file already exists, it is overwritten. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.- Specified by:
movein interfacePathProcessor- Parameters:
source- The file to move from, must not benull.target- The file to move to, must not benull.- Throws:
IOException- If an I/O error occurs.
-