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

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit df315eea85fe4a916a29f29fa27398ca697e91ba
Author: Andy Seaborne <[email protected]>
AuthorDate: Mon Sep 30 16:43:10 2024 +0100

    Javadoc and comments
---
 .../java/org/apache/jena/atlas/io/CharStream.java  |  9 ++---
 .../org/apache/jena/atlas/io/CharStreamBasic.java  | 40 +++++++++-------------
 .../src/main/java/org/apache/jena/atlas/io/IO.java |  3 ++
 .../java/org/apache/jena/irix/IRIProvider.java     | 25 +++++++-------
 .../java/org/apache/jena/irix/SetupJenaIRI.java    |  2 +-
 5 files changed, 37 insertions(+), 42 deletions(-)

diff --git a/jena-base/src/main/java/org/apache/jena/atlas/io/CharStream.java 
b/jena-base/src/main/java/org/apache/jena/atlas/io/CharStream.java
index 6f21bd3b18..a5078e0d57 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/io/CharStream.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/io/CharStream.java
@@ -19,13 +19,14 @@
 package org.apache.jena.atlas.io;
 
 
-/** A simplified reader interface without IOExceptions. 
- * And it's an interface, not an abstract class 
+/**
+ * A simplified reader interface without IOExceptions.
+ * It's an interface, not an abstract class
  */
 public interface CharStream
 {
     public int advance() ;
-    
+
     /** Close the stream - different name from java.io.Reader.close */
-    public void closeStream() ;     
+    public void closeStream() ;
 }
diff --git 
a/jena-base/src/main/java/org/apache/jena/atlas/io/CharStreamBasic.java 
b/jena-base/src/main/java/org/apache/jena/atlas/io/CharStreamBasic.java
index 27416d9bce..83e35655d5 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/io/CharStreamBasic.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/io/CharStreamBasic.java
@@ -18,40 +18,32 @@
 
 package org.apache.jena.atlas.io;
 
-import java.io.IOException ;
-import java.io.Reader ;
+import java.io.IOException;
+import java.io.Reader;
 
 /** A PeekReaderSource that does no buffering - just wraps a reader. */
-public final class CharStreamBasic extends CharStreamReader
-{
-    private Reader reader ;
+public final class CharStreamBasic extends CharStreamReader {
+    private Reader reader;
 
-    CharStreamBasic(Reader reader)
-    {
-        this.reader = reader ;
+    CharStreamBasic(Reader reader) {
+        this.reader = reader;
     }
-    
+
     @Override
-    public int advance()
-    {
-        try
-        {
-            return reader.read() ;
-        } catch (IOException ex)
-        {
+    public int advance() {
+        try {
+            return reader.read();
+        } catch (IOException ex) {
             ex.printStackTrace();
-            return -1 ;
+            return -1;
         }
     }
 
     @Override
-    public void closeStream()
-    {
-        try
-        {
-            reader.close() ;
-        } catch (IOException ex)
-        {
+    public void closeStream() {
+        try {
+            reader.close();
+        } catch (IOException ex) {
             ex.printStackTrace();
         }
     }
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java 
b/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
index 5dc8211247..b93372e25b 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
@@ -278,6 +278,9 @@ public class IO
         return out;
     }
 
+    /** An {@link OutputStream} that discards all bytes. */
+    static public OutputStream sink()                       { return 
OutputStream.nullOutputStream(); }
+
     /** Wrap in a general writer interface */
     static public AWriter wrap(Writer w)                    { return 
Writer2.wrap(w); }
 
diff --git a/jena-core/src/main/java/org/apache/jena/irix/IRIProvider.java 
b/jena-core/src/main/java/org/apache/jena/irix/IRIProvider.java
index fa748004f3..4778fa8425 100644
--- a/jena-core/src/main/java/org/apache/jena/irix/IRIProvider.java
+++ b/jena-core/src/main/java/org/apache/jena/irix/IRIProvider.java
@@ -22,31 +22,30 @@ package org.apache.jena.irix;
  * Provider: an implementation of a factory for IRIs.
  * This is not an application interface - is the plugin for the provider to 
jena.
  *
+ *
  * @see IRIxResolver
  */
 public interface IRIProvider {
     /**
-     * Create an IRI, throw {@link IRIException} if the string does not 
conform to the grammar.
+     * Create an IRI, throw {@link IRIException} if the string does not 
conform to the grammar of
+     * <a href="https://www.w3.org/TR/rdf12-concepts/#iri-abnf";>RFC 
3986/3987</a>.
+     * <p>
+     * The returned {@link IRIx} may have additional information about 
violations of
+     * URI schemes; these do not cause an exception.
      */
     public IRIx create(String iri) throws IRIException;
 
-//    /**
-//     * Create an IRI, throw {@link IRIException} if the string does not 
conform to the grammar.
-//     * If there provider has additional errors and warnings about the IRI, 
these are signalled
-//     * using the two consumer functions.
-//     * This operation may still throw IRIException if the IRI string is 
unacceptable.
-//     */
-//    public void check(String iri, Consumer<String> errors, Consumer<String> 
warnings) throws IRIException;
-
     /**
-     * Create an IRI, throw {@link IRIException} if the string does not 
conform to the grammar
-     * or violates additional rules of the provider.
+     * Check an IRI, throw {@link IRIException} if the string does not conform 
to the
+     * grammar of <a href="https://www.w3.org/TR/rdf12-concepts/#iri-abnf";>RFC
+     * 3986/3987</a>,  or violates additional rules of a URI scheme know to the
+     * provider.
      */
     public void check(String iriStr) throws IRIException;
 
     /**
-     * Run in strict mode - the exact definition of "strict" depends on the 
provider.
-     * When strict a provider should implement to the letter of the 
specifications,
+     * Run in strict mode for a given URI scheme - the exact definition of 
"strict" depends on the provider.
+     * When strict, a provider should implement to the letter of the 
specifications,
      * including URI-scheme rules. This strictness should be documented.
      */
     public void strictMode(String scheme, boolean runStrict);
diff --git a/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java 
b/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java
index 11d9c8b592..1639236980 100644
--- a/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java
+++ b/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java
@@ -64,7 +64,7 @@ public class SetupJenaIRI {
         // Allow relative references for file: URLs.
         iriCheckerFactory.setSameSchemeRelativeReferences("file");
 
-        // See also Checker.iriViolations and IRProviderJenaIRI where this is 
restricted to the scheme component.
+        // See also IRIProviderJenaIRI where this is restricted to the scheme 
component.
         setErrorWarning(iriCheckerFactory, ViolationCodes.LOWERCASE_PREFERRED, 
false, true);
         // Jena3 compatibility (false, false) for this one.
         setErrorWarning(iriCheckerFactory, 
ViolationCodes.PERCENT_ENCODING_SHOULD_BE_UPPERCASE, false, false);

Reply via email to