Class DefaultPathProcessor

java.lang.Object
org.eclipse.aether.internal.impl.DefaultPathProcessor
All Implemented Interfaces:
PathProcessor

@Singleton @Named public class DefaultPathProcessor extends Object implements PathProcessor
A utility class helping with file-based operations.
  • Constructor Details

  • Method Details

    • setLastModified

      public void setLastModified(Path path, long value) throws IOException
      Description copied from interface: PathProcessor
      Sets last modified of path in milliseconds, if exists.
      Specified by:
      setLastModified in interface PathProcessor
      Parameters:
      path - The path, may be null.
      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.
    • write

      public void write(Path target, String data) throws IOException
      Description copied from interface: PathProcessor
      Writes 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:
      write in interface PathProcessor
      Parameters:
      target - The file to write to, must not be null. This file will be overwritten.
      data - The data to write, may be null.
      Throws:
      IOException - If an I/O error occurs.
    • write

      public void write(Path target, InputStream source) throws IOException
      Description copied from interface: PathProcessor
      Writes 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:
      write in interface PathProcessor
      Parameters:
      target - The file to write to, must not be null. This file will be overwritten.
      source - The stream to write to the file, must not be null.
      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: PathProcessor
      Copies 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:
      copy in interface PathProcessor
      Parameters:
      source - The file to copy from, must not be null.
      target - The file to copy to, must not be null.
      listener - The listener to notify about the copy progress, may be null.
      Returns:
      The number of copied bytes.
      Throws:
      IOException - If an I/O error occurs.
    • move

      public void move(Path source, Path target) throws IOException
      Description copied from interface: PathProcessor
      Moves 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:
      move in interface PathProcessor
      Parameters:
      source - The file to move from, must not be null.
      target - The file to move to, must not be null.
      Throws:
      IOException - If an I/O error occurs.