You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2026/04/26 13:56:45 UTC

(groovy) branch master updated: Add missing Javadoc for groovy-nio

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 65332d1ffb Add missing Javadoc for groovy-nio
65332d1ffb is described below

commit 65332d1ffb9367dd4ab973213e889e6149e11dec
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Apr 26 22:56:27 2026 +0900

    Add missing Javadoc for groovy-nio
---
 .../apache/groovy/nio/runtime/WritablePath.java    | 55 +++++++++++++++++++++-
 1 file changed, 54 insertions(+), 1 deletion(-)

diff --git a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java
index 7ddcbba8ea..a98fb71f3c 100644
--- a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java
+++ b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/runtime/WritablePath.java
@@ -37,22 +37,46 @@ import java.nio.file.WatchService;
 import java.util.Iterator;
 
 /**
- * A Writable Path.
+ * {@link Path} wrapper that also implements {@link Writable}.
+ * <p>
+ * All {@code Path} operations are delegated to the wrapped path, while
+ * {@link #writeTo(Writer)} streams the path contents using the configured
+ * character encoding when one is supplied.
  */
 public class WritablePath implements Path, Writable {
 
     private final String encoding;
     private final Path delegate;
 
+    /**
+     * Creates a writable wrapper that uses the platform default charset when
+     * reading the path contents.
+     *
+     * @param delegate the path to wrap
+     */
     public WritablePath(final Path delegate) {
         this(delegate, null);
     }
 
+    /**
+     * Creates a writable wrapper for the supplied path.
+     *
+     * @param delegate the path to wrap
+     * @param encoding the charset name to use when reading path contents;
+     *     {@code null} uses the platform default charset
+     */
     public WritablePath(final Path delegate, final String encoding) {
         this.encoding = encoding;
         this.delegate = delegate;
     }
 
+    /**
+     * Writes the wrapped path contents to the supplied writer.
+     *
+     * @param out the destination writer
+     * @return the supplied writer
+     * @throws IOException if the path cannot be read or the writer cannot be updated
+     */
     @Override
     public Writer writeTo(final Writer out) throws IOException {
 
@@ -69,146 +93,175 @@ public class WritablePath implements Path, Writable {
         return out;
     }
 
+    /** {@inheritDoc} */
     @Override
     public FileSystem getFileSystem() {
         return delegate.getFileSystem();
     }
 
+    /** {@inheritDoc} */
     @Override
     public boolean isAbsolute() {
         return delegate.isAbsolute();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path getRoot() {
         return delegate.getRoot();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path getFileName() {
         return delegate.getFileName();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path getParent() {
         return delegate.getParent();
     }
 
+    /** {@inheritDoc} */
     @Override
     public int getNameCount() {
         return delegate.getNameCount();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path getName(int index) {
         return delegate.getName(index);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path subpath(int beginIndex, int endIndex) {
         return delegate.subpath(beginIndex, endIndex);
     }
 
+    /** {@inheritDoc} */
     @Override
     public boolean startsWith(Path other) {
         return delegate.startsWith(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public boolean startsWith(String other) {
         return delegate.startsWith(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public boolean endsWith(Path other) {
         return delegate.endsWith(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public boolean endsWith(String other) {
         return delegate.endsWith(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path normalize() {
         return delegate.normalize();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path resolve(Path other) {
         return delegate.resolve(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path resolve(String other) {
         return delegate.resolve(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path resolveSibling(Path other) {
         return delegate.resolveSibling(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path resolveSibling(String other) {
         return delegate.resolveSibling(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path relativize(Path other) {
         return delegate.relativize(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public URI toUri() {
         return delegate.toUri();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path toAbsolutePath() {
         return delegate.toAbsolutePath();
     }
 
+    /** {@inheritDoc} */
     @Override
     public Path toRealPath(LinkOption... options) throws IOException {
         return delegate.toRealPath(options);
     }
 
+    /** {@inheritDoc} */
     @Override
     public File toFile() {
         return delegate.toFile();
     }
 
+    /** {@inheritDoc} */
     @Override
     public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException {
         return delegate.register(watcher, events, modifiers);
     }
 
+    /** {@inheritDoc} */
     @Override
     public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) throws IOException {
         return delegate.register(watcher, events);
     }
 
+    /** {@inheritDoc} */
     @Override
     public Iterator<Path> iterator() {
         return delegate.iterator();
     }
 
+    /** {@inheritDoc} */
     @Override
     public int compareTo(Path other) {
         return delegate.compareTo(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public boolean equals(Object other) {
         return delegate.equals(other);
     }
 
+    /** {@inheritDoc} */
     @Override
     public int hashCode() {
         return delegate.hashCode();
     }
 
+    /** {@inheritDoc} */
     @Override
     public String toString() {
         return delegate.toString();