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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c53c39c [IO-829] Don't decode and reencode characters in a 
potentially different charset in 
AbstractOrigin.CharSequenceOrigin.getReader(Charset)
3c53c39c is described below

commit 3c53c39c453b73af4971c7654f31b10bbd674359
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Dec 28 08:33:53 2023 -0500

    [IO-829] Don't decode and reencode characters in a potentially different
    charset in AbstractOrigin.CharSequenceOrigin.getReader(Charset)
    
    Javadoc
---
 .../apache/commons/io/build/AbstractOrigin.java    | 69 +++++++++++++++++++++-
 1 file changed, 66 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/build/AbstractOrigin.java 
b/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
index ddf1936d..e0c574eb 100644
--- a/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
+++ b/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
@@ -78,6 +78,12 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
             return get();
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@code byte[]} 
does not need an {@link OpenOption} to be read.
+         * </p>
+         */
         @Override
         public InputStream getInputStream(final OpenOption... options) throws 
IOException {
             return new ByteArrayInputStream(origin);
@@ -118,7 +124,7 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
         /**
          * {@inheritDoc}
          * <p>
-         * In this case, the {@code charset} parameter is ignored, since a 
{@link CharSequence} does not need a {@link Charset} to be read.
+         * The {@code charset} parameter is ignored since a {@link 
CharSequence} does not need a {@link Charset} to be read.
          * </p>
          */
         @Override
@@ -127,6 +133,12 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
             return get();
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@link 
CharSequence} does not need an {@link OpenOption} to be read.
+         * </p>
+         */
         @Override
         public InputStream getInputStream(final OpenOption... options) throws 
IOException {
             // TODO Pass in a Charset? Consider if call sites actually need 
this.
@@ -136,11 +148,11 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
         /**
          * {@inheritDoc}
          * <p>
-         * In this case, the {@code charset} parameter is ignored, since a 
{@link CharSequence} does not need a {@link Charset} to be read.
+         * The {@code charset} parameter is ignored since a {@link 
CharSequence} does not need a {@link Charset} to be read.
          * </p>
          */
         @Override
-        public Reader getReader(final Charset ignore) throws IOException {
+        public Reader getReader(final Charset charset) throws IOException {
             return new CharSequenceReader(get());
         }
 
@@ -210,6 +222,12 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
             return IOUtils.toByteArray(origin);
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@link 
InputStream} does not need an {@link OpenOption} to be read.
+         * </p>
+         */
         @Override
         public InputStream getInputStream(final OpenOption... options) {
             // No conversion
@@ -240,12 +258,24 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
             super(origin);
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@link 
OutputStream} does not need an {@link OpenOption} to be written.
+         * </p>
+         */
         @Override
         public OutputStream getOutputStream(final OpenOption... options) {
             // No conversion
             return get();
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@link 
OutputStream} does not need an {@link OpenOption} to be written.
+         * </p>
+         */
         @Override
         public Writer getWriter(final Charset charset, final OpenOption... 
options) throws IOException {
             return new OutputStreamWriter(origin, charset);
@@ -312,17 +342,35 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
             return IOUtils.toByteArray(origin, Charset.defaultCharset());
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code charset} parameter is ignored since a {@link Reader} 
does not need a {@link Charset} to be read.
+         * </p>
+         */
         @Override
         public CharSequence getCharSequence(final Charset charset) throws 
IOException {
             return IOUtils.toString(origin);
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@link Reader} 
does not need an {@link OpenOption} to be read.
+         * </p>
+         */
         @Override
         public InputStream getInputStream(final OpenOption... options) throws 
IOException {
             // TODO Pass in a Charset? Consider if call sites actually need 
this.
             return 
ReaderInputStream.builder().setReader(origin).setCharset(Charset.defaultCharset()).get();
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code charset} parameter is ignored since a {@link Reader} 
does not need a {@link Charset} to be read.
+         * </p>
+         */
         @Override
         public Reader getReader(final Charset charset) throws IOException {
             // No conversion
@@ -373,12 +421,27 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
             super(origin);
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code options} parameter is ignored since a {@link Writer} 
does not need an {@link OpenOption} to be written.
+         * </p>
+         */
         @Override
         public OutputStream getOutputStream(final OpenOption... options) 
throws IOException {
             // TODO Pass in a Charset? Consider if call sites actually need 
this.
             return 
WriterOutputStream.builder().setWriter(origin).setCharset(Charset.defaultCharset()).get();
         }
 
+        /**
+         * {@inheritDoc}
+         * <p>
+         * The {@code charset} parameter is ignored since a {@link Writer} 
does not need a {@link Charset} to be written.
+         * </p>
+         * <p>
+         * The {@code options} parameter is ignored since a {@link Writer} 
does not need an {@link OpenOption} to be written.
+         * </p>
+         */
         @Override
         public Writer getWriter(final Charset charset, final OpenOption... 
options) throws IOException {
             // No conversion

Reply via email to