You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/03/21 14:50:00 UTC

[commons-imaging] branch master updated (469b00c6 -> b90b2fec)

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

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


    from 469b00c6 Remove obsolete comments
     new 9d635954 Exclude Maven target folder from checkstyle
     new b90b2fec BinaryOutputStream now subclasses FilterOutputStream instead of OutputStream and does not need to count bytes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  1 +
 src/changes/changes.xml                            |  3 ++
 .../commons/imaging/common/BinaryOutputStream.java | 35 ++++++----------------
 3 files changed, 13 insertions(+), 26 deletions(-)


[commons-imaging] 02/02: BinaryOutputStream now subclasses FilterOutputStream instead of OutputStream and does not need to count bytes

Posted by gg...@apache.org.
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-imaging.git

commit b90b2fecd97240bb4d57402adbc39fdeac75920d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Mar 21 10:49:56 2023 -0400

    BinaryOutputStream now subclasses FilterOutputStream instead of
    OutputStream and does not need to count bytes
---
 src/changes/changes.xml                            |  3 ++
 .../commons/imaging/common/BinaryOutputStream.java | 35 ++++++----------------
 2 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 47917d02..7d39572d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,6 +54,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action issue="IMAGING-342" dev="kinow" type="fix" due-to="Glavo">
         Read PNG metadata from iTXt chunk.
       </action>
+      <action dev="ggregory" type="update" due-to="Gary Gregory">
+        BinaryOutputStream now subclasses FilterOutputStream instead of OutputStream and does not need to count bytes.
+      </action>
       <!-- UPDATE -->
       <action dev="kinow" type="update" due-to="Dependabot, Gary Gregory">
         Bump actions/cache from 3.0.4 to 3.0.10 #225, #228, #239, #240.
diff --git a/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java b/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
index 1d393d9a..631ddcf5 100644
--- a/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
@@ -16,23 +16,23 @@
  */
 package org.apache.commons.imaging.common;
 
+import java.io.FilterOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.ByteOrder;
 
-public class BinaryOutputStream extends OutputStream {
-    private final OutputStream os;
-    // default byte order for Java, many file formats.
+public class BinaryOutputStream extends FilterOutputStream {
+
+    /** Default byte order for Java, many file formats. */
     private ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
-    private int count;
 
     public BinaryOutputStream(final OutputStream os, final ByteOrder byteOrder) {
+        super(os);
         this.byteOrder = byteOrder;
-        this.os = os;
     }
 
     public BinaryOutputStream(final OutputStream os) {
-        this.os = os;
+        super(os);
     }
 
     protected void setByteOrder(final ByteOrder byteOrder) {
@@ -45,34 +45,17 @@ public class BinaryOutputStream extends OutputStream {
 
     @Override
     public void write(final int i) throws IOException {
-        os.write(i);
-        count++;
+        super.write(i);
     }
 
     @Override
     public final void write(final byte[] bytes) throws IOException {
-        os.write(bytes, 0, bytes.length);
-        count += bytes.length;
+        super.write(bytes, 0, bytes.length);
     }
 
     @Override
     public final void write(final byte[] bytes, final int offset, final int length) throws IOException {
-        os.write(bytes, offset, length);
-        count += length;
-    }
-
-    @Override
-    public void flush() throws IOException {
-        os.flush();
-    }
-
-    @Override
-    public void close() throws IOException {
-        os.close();
-    }
-
-    public int getByteCount() {
-        return count;
+        super.write(bytes, offset, length);
     }
 
     public final void write4Bytes(final int value) throws IOException {


[commons-imaging] 01/02: Exclude Maven target folder from checkstyle

Posted by gg...@apache.org.
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-imaging.git

commit 9d635954e89827685b0be2b04813327543c85186
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Mar 21 10:49:49 2023 -0400

    Exclude Maven target folder from checkstyle
---
 pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pom.xml b/pom.xml
index cfb1dffd..25321f5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -157,6 +157,7 @@
           <suppressionsLocation>${basedir}/checkstyle-suppressions.xml</suppressionsLocation>
           <includeTestSourceDirectory>false</includeTestSourceDirectory>
           <enableRulesSummary>false</enableRulesSummary>
+          <excludes>target/**</excludes>
         </configuration>
       </plugin>
       <plugin>