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 2019/08/19 21:25:30 UTC

[commons-vfs] branch master updated: Sort members.

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-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new f63f66f  Sort members.
f63f66f is described below

commit f63f66ff5c0fa1b4c2abf4f45ae30e6019a5c139
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 19 14:25:26 2019 -0700

    Sort members.
---
 .../commons/vfs2/util/MonitorInputStream.java      | 94 +++++++++++-----------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java
index 642ef46..98dd772 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java
@@ -28,8 +28,8 @@ import java.util.concurrent.atomic.AtomicLong;
 public class MonitorInputStream extends BufferedInputStream {
 
     private static final int EOF_CHAR = -1;
-    private final AtomicBoolean finished = new AtomicBoolean(false);
     private final AtomicLong atomicCount = new AtomicLong(0);
+    private final AtomicBoolean finished = new AtomicBoolean(false);
 
     /**
      * Constructs a MonitorInputStream from the passed InputStream
@@ -68,48 +68,6 @@ public class MonitorInputStream extends BufferedInputStream {
     }
 
     /**
-     * Reads a character.
-     *
-     * @return The character that was read as an integer.
-     * @throws IOException if an error occurs.
-     */
-    @Override
-    public int read() throws IOException { // lgtm [java/non-sync-override]
-        if (finished.get()) {
-            return EOF_CHAR;
-        }
-
-        final int ch = super.read();
-        if (ch != EOF_CHAR) {
-            atomicCount.incrementAndGet();
-        }
-
-        return ch;
-    }
-
-    /**
-     * Reads bytes from this input stream.
-     *
-     * @param buffer A byte array in which to place the characters read.
-     * @param offset The offset at which to start reading.
-     * @param length The maximum number of bytes to read.
-     * @return The number of bytes read.
-     * @throws IOException if an error occurs.
-     */
-    @Override
-    public int read(final byte[] buffer, final int offset, final int length) throws IOException { // lgtm [java/non-sync-override]
-        if (finished.get()) {
-            return EOF_CHAR;
-        }
-
-        final int nread = super.read(buffer, offset, length);
-        if (nread != EOF_CHAR) {
-            atomicCount.addAndGet(nread);
-        }
-        return nread;
-    }
-
-    /**
      * Closes this input stream and releases any system resources associated with the stream.
      *
      * @throws IOException if an error occurs.
@@ -142,6 +100,15 @@ public class MonitorInputStream extends BufferedInputStream {
     }
 
     /**
+     * Gets the number of bytes read by this input stream.
+     *
+     * @return The number of bytes read by this input stream.
+     */
+    public long getCount() {
+        return atomicCount.get();
+    }
+
+    /**
      * Called after the stream has been closed. This implementation does nothing.
      *
      * @throws IOException if an error occurs.
@@ -151,11 +118,44 @@ public class MonitorInputStream extends BufferedInputStream {
     }
 
     /**
-     * Gets the number of bytes read by this input stream.
+     * Reads a character.
      *
-     * @return The number of bytes read by this input stream.
+     * @return The character that was read as an integer.
+     * @throws IOException if an error occurs.
      */
-    public long getCount() {
-        return atomicCount.get();
+    @Override
+    public int read() throws IOException { // lgtm [java/non-sync-override]
+        if (finished.get()) {
+            return EOF_CHAR;
+        }
+
+        final int ch = super.read();
+        if (ch != EOF_CHAR) {
+            atomicCount.incrementAndGet();
+        }
+
+        return ch;
+    }
+
+    /**
+     * Reads bytes from this input stream.
+     *
+     * @param buffer A byte array in which to place the characters read.
+     * @param offset The offset at which to start reading.
+     * @param length The maximum number of bytes to read.
+     * @return The number of bytes read.
+     * @throws IOException if an error occurs.
+     */
+    @Override
+    public int read(final byte[] buffer, final int offset, final int length) throws IOException { // lgtm [java/non-sync-override]
+        if (finished.get()) {
+            return EOF_CHAR;
+        }
+
+        final int nread = super.read(buffer, offset, length);
+        if (nread != EOF_CHAR) {
+            atomicCount.addAndGet(nread);
+        }
+        return nread;
     }
 }