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 2021/01/19 15:58:58 UTC

[commons-io] branch master updated: Checkstyle left curly.

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 e3eade7  Checkstyle left curly.
e3eade7 is described below

commit e3eade73c5fd753d6c2e52508b3437e77d1a67d2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jan 19 10:58:53 2021 -0500

    Checkstyle left curly.
---
 checkstyle.xml                                     |   1 +
 .../java/org/apache/commons/io/EndianUtils.java    | 143 ++++++++-------------
 .../commons/io/input/ObservableInputStream.java    |   4 +-
 .../commons/io/input/SwappedDataInputStream.java   | 122 +++++++-----------
 .../io/output/ThresholdingOutputStream.java        | 135 ++++++-------------
 5 files changed, 148 insertions(+), 257 deletions(-)

diff --git a/checkstyle.xml b/checkstyle.xml
index a00be8e..af2ee30 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -38,6 +38,7 @@ limitations under the License.
     <module name="RedundantImport"/>
     <module name="UnusedImports"/>
     <module name="NeedBraces"/>
+    <module name="LeftCurly"/>
     <module name="JavadocMethod">
     </module>
  </module>
diff --git a/src/main/java/org/apache/commons/io/EndianUtils.java b/src/main/java/org/apache/commons/io/EndianUtils.java
index eaf65ef..5d2e294 100644
--- a/src/main/java/org/apache/commons/io/EndianUtils.java
+++ b/src/main/java/org/apache/commons/io/EndianUtils.java
@@ -272,11 +272,9 @@ public class EndianUtils {
      * @param value value to write
      * @throws IOException in case of an I/O problem
      */
-    public static void writeSwappedShort(final OutputStream output, final short value)
-        throws IOException
-    {
-        output.write( (byte)( ( value >> 0 ) & 0xff ) );
-        output.write( (byte)( ( value >> 8 ) & 0xff ) );
+    public static void writeSwappedShort(final OutputStream output, final short value) throws IOException {
+        output.write((byte) ((value >> 0) & 0xff));
+        output.write((byte) ((value >> 8) & 0xff));
     }
 
     /**
@@ -286,11 +284,8 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static short readSwappedShort(final InputStream input)
-        throws IOException
-    {
-        return (short)( ( ( read( input ) & 0xff ) << 0 ) +
-            ( ( read( input ) & 0xff ) << 8 ) );
+    public static short readSwappedShort(final InputStream input) throws IOException {
+        return (short) (((read(input) & 0xff) << 0) + ((read(input) & 0xff) << 8));
     }
 
     /**
@@ -300,30 +295,25 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static int readSwappedUnsignedShort(final InputStream input)
-        throws IOException
-    {
-        final int value1 = read( input );
-        final int value2 = read( input );
-
-        return ( ( ( value1 & 0xff ) << 0 ) +
-            ( ( value2 & 0xff ) << 8 ) );
+    public static int readSwappedUnsignedShort(final InputStream input) throws IOException {
+        final int value1 = read(input);
+        final int value2 = read(input);
+
+        return (((value1 & 0xff) << 0) + ((value2 & 0xff) << 8));
     }
 
     /**
-     * Writes a "int" value to an OutputStream. The value is
-     * converted to the opposed endian system while writing.
+     * Writes a "int" value to an OutputStream. The value is converted to the opposed endian system while writing.
+     * 
      * @param output target OutputStream
      * @param value value to write
      * @throws IOException in case of an I/O problem
      */
-    public static void writeSwappedInteger(final OutputStream output, final int value)
-        throws IOException
-    {
-        output.write( (byte)( ( value >> 0 ) & 0xff ) );
-        output.write( (byte)( ( value >> 8 ) & 0xff ) );
-        output.write( (byte)( ( value >> 16 ) & 0xff ) );
-        output.write( (byte)( ( value >> 24 ) & 0xff ) );
+    public static void writeSwappedInteger(final OutputStream output, final int value) throws IOException {
+        output.write((byte) ((value >> 0) & 0xff));
+        output.write((byte) ((value >> 8) & 0xff));
+        output.write((byte) ((value >> 16) & 0xff));
+        output.write((byte) ((value >> 24) & 0xff));
     }
 
     /**
@@ -333,18 +323,13 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static int readSwappedInteger(final InputStream input)
-        throws IOException
-    {
-        final int value1 = read( input );
-        final int value2 = read( input );
-        final int value3 = read( input );
-        final int value4 = read( input );
-
-        return ( ( value1 & 0xff ) << 0 ) +
-            ( ( value2 & 0xff ) << 8 ) +
-            ( ( value3 & 0xff ) << 16 ) +
-            ( ( value4 & 0xff ) << 24 );
+    public static int readSwappedInteger(final InputStream input) throws IOException {
+        final int value1 = read(input);
+        final int value2 = read(input);
+        final int value3 = read(input);
+        final int value4 = read(input);
+
+        return ((value1 & 0xff) << 0) + ((value2 & 0xff) << 8) + ((value3 & 0xff) << 16) + ((value4 & 0xff) << 24);
     }
 
     /**
@@ -354,17 +339,13 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static long readSwappedUnsignedInteger(final InputStream input)
-        throws IOException
-    {
-        final int value1 = read( input );
-        final int value2 = read( input );
-        final int value3 = read( input );
-        final int value4 = read( input );
-
-        final long low = ( ( ( value1 & 0xff ) << 0 ) +
-                     ( ( value2 & 0xff ) << 8 ) +
-                     ( ( value3 & 0xff ) << 16 ) );
+    public static long readSwappedUnsignedInteger(final InputStream input) throws IOException {
+        final int value1 = read(input);
+        final int value2 = read(input);
+        final int value3 = read(input);
+        final int value4 = read(input);
+
+        final long low = (((value1 & 0xff) << 0) + ((value2 & 0xff) << 8) + ((value3 & 0xff) << 16));
 
         final long high = value4 & 0xff;
 
@@ -378,17 +359,15 @@ public class EndianUtils {
      * @param value value to write
      * @throws IOException in case of an I/O problem
      */
-    public static void writeSwappedLong(final OutputStream output, final long value)
-        throws IOException
-    {
-        output.write( (byte)( ( value >> 0 ) & 0xff ) );
-        output.write( (byte)( ( value >> 8 ) & 0xff ) );
-        output.write( (byte)( ( value >> 16 ) & 0xff ) );
-        output.write( (byte)( ( value >> 24 ) & 0xff ) );
-        output.write( (byte)( ( value >> 32 ) & 0xff ) );
-        output.write( (byte)( ( value >> 40 ) & 0xff ) );
-        output.write( (byte)( ( value >> 48 ) & 0xff ) );
-        output.write( (byte)( ( value >> 56 ) & 0xff ) );
+    public static void writeSwappedLong(final OutputStream output, final long value) throws IOException {
+        output.write((byte) ((value >> 0) & 0xff));
+        output.write((byte) ((value >> 8) & 0xff));
+        output.write((byte) ((value >> 16) & 0xff));
+        output.write((byte) ((value >> 24) & 0xff));
+        output.write((byte) ((value >> 32) & 0xff));
+        output.write((byte) ((value >> 40) & 0xff));
+        output.write((byte) ((value >> 48) & 0xff));
+        output.write((byte) ((value >> 56) & 0xff));
     }
 
     /**
@@ -398,14 +377,12 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static long readSwappedLong(final InputStream input)
-        throws IOException
-    {
+    public static long readSwappedLong(final InputStream input) throws IOException {
         final byte[] bytes = new byte[8];
-        for ( int i=0; i<8; i++ ) {
-            bytes[i] = (byte) read( input );
+        for (int i = 0; i < 8; i++) {
+            bytes[i] = (byte) read(input);
         }
-        return readSwappedLong( bytes, 0 );
+        return readSwappedLong(bytes, 0);
     }
 
     /**
@@ -415,10 +392,8 @@ public class EndianUtils {
      * @param value value to write
      * @throws IOException in case of an I/O problem
      */
-    public static void writeSwappedFloat(final OutputStream output, final float value)
-        throws IOException
-    {
-        writeSwappedInteger( output, Float.floatToIntBits( value ) );
+    public static void writeSwappedFloat(final OutputStream output, final float value) throws IOException {
+        writeSwappedInteger(output, Float.floatToIntBits(value));
     }
 
     /**
@@ -428,10 +403,8 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static float readSwappedFloat(final InputStream input)
-        throws IOException
-    {
-        return Float.intBitsToFloat( readSwappedInteger( input ) );
+    public static float readSwappedFloat(final InputStream input) throws IOException {
+        return Float.intBitsToFloat(readSwappedInteger(input));
     }
 
     /**
@@ -441,10 +414,8 @@ public class EndianUtils {
      * @param value value to write
      * @throws IOException in case of an I/O problem
      */
-    public static void writeSwappedDouble(final OutputStream output, final double value)
-        throws IOException
-    {
-        writeSwappedLong( output, Double.doubleToLongBits( value ) );
+    public static void writeSwappedDouble(final OutputStream output, final double value) throws IOException {
+        writeSwappedLong(output, Double.doubleToLongBits(value));
     }
 
     /**
@@ -454,10 +425,8 @@ public class EndianUtils {
      * @return the value just read
      * @throws IOException in case of an I/O problem
      */
-    public static double readSwappedDouble(final InputStream input)
-        throws IOException
-    {
-        return Double.longBitsToDouble( readSwappedLong( input ) );
+    public static double readSwappedDouble(final InputStream input) throws IOException {
+        return Double.longBitsToDouble(readSwappedLong(input));
     }
 
     /**
@@ -466,13 +435,11 @@ public class EndianUtils {
      * @return the byte
      * @throws IOException if the end of file is reached
      */
-    private static int read(final InputStream input)
-        throws IOException
-    {
+    private static int read(final InputStream input) throws IOException {
         final int value = input.read();
 
-        if( EOF == value ) {
-            throw new EOFException( "Unexpected EOF reached" );
+        if (EOF == value) {
+            throw new EOFException("Unexpected EOF reached");
         }
 
         return value;
diff --git a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
index 43e1d13..9b7cb2a 100644
--- a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
@@ -92,7 +92,9 @@ public class ObservableInputStream extends ProxyInputStream {
          * @param pException the exception to throw
          * @throws IOException if an i/o-error occurs
          */
-        public void error(final IOException pException) throws IOException { throw pException; }
+        public void error(final IOException pException) throws IOException {
+            throw pException;
+        }
     }
 
     private final List<Observer> observers = new ArrayList<>();
diff --git a/src/main/java/org/apache/commons/io/input/SwappedDataInputStream.java b/src/main/java/org/apache/commons/io/input/SwappedDataInputStream.java
index 6289e59..4d57f7d 100644
--- a/src/main/java/org/apache/commons/io/input/SwappedDataInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/SwappedDataInputStream.java
@@ -26,91 +26,82 @@ import java.io.InputStream;
 import org.apache.commons.io.EndianUtils;
 
 /**
- * DataInput for systems relying on little endian data formats.
- * When read, values will be changed from little endian to big
- * endian formats for internal usage.
+ * DataInput for systems relying on little endian data formats. When read, values will be changed from little endian to
+ * big endian formats for internal usage.
  * <p>
  * <b>Origin of code: </b>Avalon Excalibur (IO)
  * </p>
  *
  */
-public class SwappedDataInputStream extends ProxyInputStream
-    implements DataInput
-{
+public class SwappedDataInputStream extends ProxyInputStream implements DataInput {
 
     /**
      * Constructs a SwappedDataInputStream.
      *
      * @param input InputStream to read from
      */
-    public SwappedDataInputStream( final InputStream input )
-    {
-        super( input );
+    public SwappedDataInputStream(final InputStream input) {
+        super(input);
     }
 
     /**
      * Return <code>{@link #readByte()} != 0</code>
+     * 
      * @return false if the byte read is zero, otherwise true
      * @throws IOException if an I/O error occurs
      * @throws EOFException if an end of file is reached unexpectedly
      */
     @Override
-    public boolean readBoolean()
-        throws IOException, EOFException
-    {
+    public boolean readBoolean() throws IOException, EOFException {
         return 0 != readByte();
     }
 
     /**
      * Invokes the delegate's {@code read()} method.
+     * 
      * @return the byte read or -1 if the end of stream
      * @throws IOException if an I/O error occurs
      * @throws EOFException if an end of file is reached unexpectedly
      */
     @Override
-    public byte readByte()
-        throws IOException, EOFException
-    {
-        return (byte)in.read();
+    public byte readByte() throws IOException, EOFException {
+        return (byte) in.read();
     }
 
     /**
      * Reads a character delegating to {@link #readShort()}.
+     * 
      * @return the byte read or -1 if the end of stream
      * @throws IOException if an I/O error occurs
      * @throws EOFException if an end of file is reached unexpectedly
      */
     @Override
-    public char readChar()
-        throws IOException, EOFException
-    {
-        return (char)readShort();
+    public char readChar() throws IOException, EOFException {
+        return (char) readShort();
     }
 
     /**
      * Delegates to {@link EndianUtils#readSwappedDouble(InputStream)}.
+     * 
      * @return the read long
      * @throws IOException if an I/O error occurs
      * @throws EOFException if an end of file is reached unexpectedly
      */
     @Override
-    public double readDouble()
-        throws IOException, EOFException
-    {
-        return EndianUtils.readSwappedDouble( in );
+    public double readDouble() throws IOException, EOFException {
+        return EndianUtils.readSwappedDouble(in);
     }
 
     /**
      * Delegates to {@link EndianUtils#readSwappedFloat(InputStream)}.
+     * 
      * @return the read long
      * @throws IOException if an I/O error occurs
      * @throws EOFException if an end of file is reached unexpectedly
      */
     @Override
-    public float readFloat()
-        throws IOException, EOFException
-    {
-        return EndianUtils.readSwappedFloat( in );
+    public float readFloat() throws IOException, EOFException {
+        return EndianUtils.readSwappedFloat(in);
     }
 
     /**
@@ -121,13 +112,10 @@ public class SwappedDataInputStream extends ProxyInputStream
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public void readFully( final byte[] data )
-        throws IOException, EOFException
-    {
-        readFully( data, 0, data.length );
+    public void readFully(final byte[] data) throws IOException, EOFException {
+        readFully(data, 0, data.length);
     }
 
-
     /**
      * Invokes the delegate's {@code read(byte[] data, int, int)} method.
      *
@@ -138,18 +126,14 @@ public class SwappedDataInputStream extends ProxyInputStream
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public void readFully( final byte[] data, final int offset, final int length )
-        throws IOException, EOFException
-    {
+    public void readFully(final byte[] data, final int offset, final int length) throws IOException, EOFException {
         int remaining = length;
 
-        while( remaining > 0 )
-        {
+        while (remaining > 0) {
             final int location = offset + length - remaining;
-            final int count = read( data, location, remaining );
+            final int count = read(data, location, remaining);
 
-            if (EOF == count)
-            {
+            if (EOF == count) {
                 throw new EOFException();
             }
 
@@ -159,109 +143,99 @@ public class SwappedDataInputStream extends ProxyInputStream
 
     /**
      * Delegates to {@link EndianUtils#readSwappedInteger(InputStream)}.
+     * 
      * @return the read long
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public int readInt()
-        throws IOException, EOFException
-    {
-        return EndianUtils.readSwappedInteger( in );
+    public int readInt() throws IOException, EOFException {
+        return EndianUtils.readSwappedInteger(in);
     }
 
     /**
      * Not currently supported - throws {@link UnsupportedOperationException}.
+     * 
      * @return the line read
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public String readLine()
-        throws IOException, EOFException
-    {
-        throw new UnsupportedOperationException(
-                "Operation not supported: readLine()" );
+    public String readLine() throws IOException, EOFException {
+        throw new UnsupportedOperationException("Operation not supported: readLine()");
     }
 
     /**
      * Delegates to {@link EndianUtils#readSwappedLong(InputStream)}.
+     * 
      * @return the read long
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public long readLong()
-        throws IOException, EOFException
-    {
-        return EndianUtils.readSwappedLong( in );
+    public long readLong() throws IOException, EOFException {
+        return EndianUtils.readSwappedLong(in);
     }
 
     /**
      * Delegates to {@link EndianUtils#readSwappedShort(InputStream)}.
+     * 
      * @return the read long
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public short readShort()
-        throws IOException, EOFException
-    {
-        return EndianUtils.readSwappedShort( in );
+    public short readShort() throws IOException, EOFException {
+        return EndianUtils.readSwappedShort(in);
     }
 
     /**
      * Invokes the delegate's {@code read()} method.
+     * 
      * @return the byte read or -1 if the end of stream
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public int readUnsignedByte()
-        throws IOException, EOFException
-    {
+    public int readUnsignedByte() throws IOException, EOFException {
         return in.read();
     }
 
     /**
      * Delegates to {@link EndianUtils#readSwappedUnsignedShort(InputStream)}.
+     * 
      * @return the read long
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public int readUnsignedShort()
-        throws IOException, EOFException
-    {
-        return EndianUtils.readSwappedUnsignedShort( in );
+    public int readUnsignedShort() throws IOException, EOFException {
+        return EndianUtils.readSwappedUnsignedShort(in);
     }
 
     /**
      * Not currently supported - throws {@link UnsupportedOperationException}.
+     * 
      * @return UTF String read
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public String readUTF()
-        throws IOException, EOFException
-    {
-        throw new UnsupportedOperationException(
-                "Operation not supported: readUTF()" );
+    public String readUTF() throws IOException, EOFException {
+        throw new UnsupportedOperationException("Operation not supported: readUTF()");
     }
 
     /**
      * Invokes the delegate's {@code skip(int)} method.
+     * 
      * @param count the number of bytes to skip
      * @return the number of bytes to skipped or -1 if the end of stream
      * @throws EOFException if an end of file is reached unexpectedly
      * @throws IOException if an I/O error occurs
      */
     @Override
-    public int skipBytes( final int count )
-        throws IOException, EOFException
-    {
-        return (int)in.skip( count );
+    public int skipBytes(final int count) throws IOException, EOFException {
+        return (int) in.skip(count);
     }
 
 }
diff --git a/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java b/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java
index 99a4b93..8170cea 100644
--- a/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java
@@ -19,64 +19,49 @@ package org.apache.commons.io.output;
 import java.io.IOException;
 import java.io.OutputStream;
 
-
 /**
- * An output stream which triggers an event when a specified number of bytes of
- * data have been written to it. The event can be used, for example, to throw
- * an exception if a maximum has been reached, or to switch the underlying
- * stream type when the threshold is exceeded.
+ * An output stream which triggers an event when a specified number of bytes of data have been written to it. The event
+ * can be used, for example, to throw an exception if a maximum has been reached, or to switch the underlying stream
+ * type when the threshold is exceeded.
  * <p>
- * This class overrides all {@code OutputStream} methods. However, these
- * overrides ultimately call the corresponding methods in the underlying output
- * stream implementation.
+ * This class overrides all {@code OutputStream} methods. However, these overrides ultimately call the corresponding
+ * methods in the underlying output stream implementation.
  * <p>
- * NOTE: This implementation may trigger the event <em>before</em> the threshold
- * is actually reached, since it triggers when a pending write operation would
- * cause the threshold to be exceeded.
+ * NOTE: This implementation may trigger the event <em>before</em> the threshold is actually reached, since it triggers
+ * when a pending write operation would cause the threshold to be exceeded.
  */
-public abstract class ThresholdingOutputStream
-    extends OutputStream
-{
+public abstract class ThresholdingOutputStream extends OutputStream {
 
     // ----------------------------------------------------------- Data members
 
-
     /**
      * The threshold at which the event will be triggered.
      */
     private final int threshold;
 
-
     /**
      * The number of bytes written to the output stream.
      */
     private long written;
 
-
     /**
      * Whether or not the configured threshold has been exceeded.
      */
     private boolean thresholdExceeded;
 
-
     // ----------------------------------------------------------- Constructors
 
-
     /**
-     * Constructs an instance of this class which will trigger an event at the
-     * specified threshold.
+     * Constructs an instance of this class which will trigger an event at the specified threshold.
      *
      * @param threshold The number of bytes at which to trigger an event.
      */
-    public ThresholdingOutputStream(final int threshold)
-    {
+    public ThresholdingOutputStream(final int threshold) {
         this.threshold = threshold;
     }
 
-
     // --------------------------------------------------- OutputStream methods
 
-
     /**
      * Writes the specified byte to this output stream.
      *
@@ -85,160 +70,126 @@ public abstract class ThresholdingOutputStream
      * @throws IOException if an error occurs.
      */
     @Override
-    public void write(final int b) throws IOException
-    {
+    public void write(final int b) throws IOException {
         checkThreshold(1);
         getStream().write(b);
         written++;
     }
 
-
     /**
-     * Writes {@code b.length} bytes from the specified byte array to this
-     * output stream.
+     * Writes {@code b.length} bytes from the specified byte array to this output stream.
      *
      * @param b The array of bytes to be written.
      *
      * @throws IOException if an error occurs.
      */
     @Override
-    public void write(final byte[] b) throws IOException
-    {
+    public void write(final byte[] b) throws IOException {
         checkThreshold(b.length);
         getStream().write(b);
         written += b.length;
     }
 
-
     /**
-     * Writes {@code len} bytes from the specified byte array starting at
-     * offset {@code off} to this output stream.
+     * Writes {@code len} bytes from the specified byte array starting at offset {@code off} to this output stream.
      *
-     * @param b   The byte array from which the data will be written.
+     * @param b The byte array from which the data will be written.
      * @param off The start offset in the byte array.
      * @param len The number of bytes to write.
      *
      * @throws IOException if an error occurs.
      */
     @Override
-    public void write(final byte[] b, final int off, final int len) throws IOException
-    {
+    public void write(final byte[] b, final int off, final int len) throws IOException {
         checkThreshold(len);
         getStream().write(b, off, len);
         written += len;
     }
 
-
     /**
-     * Flushes this output stream and forces any buffered output bytes to be
-     * written out.
+     * Flushes this output stream and forces any buffered output bytes to be written out.
      *
      * @throws IOException if an error occurs.
      */
     @Override
-    public void flush() throws IOException
-    {
+    public void flush() throws IOException {
         getStream().flush();
     }
 
-
     /**
-     * Closes this output stream and releases any system resources associated
-     * with this stream.
+     * Closes this output stream and releases any system resources associated with this stream.
      *
      * @throws IOException if an error occurs.
      */
     @Override
-    public void close() throws IOException
-    {
-        try
-        {
+    public void close() throws IOException {
+        try {
             flush();
-        }
-        catch (final IOException ignored)
-        {
+        } catch (final IOException ignored) {
             // ignore
         }
         getStream().close();
     }
 
-
     // --------------------------------------------------------- Public methods
 
-
     /**
      * Returns the threshold, in bytes, at which an event will be triggered.
      *
      * @return The threshold point, in bytes.
      */
-    public int getThreshold()
-    {
+    public int getThreshold() {
         return threshold;
     }
 
-
     /**
      * Returns the number of bytes that have been written to this output stream.
      *
      * @return The number of bytes written.
      */
-    public long getByteCount()
-    {
+    public long getByteCount() {
         return written;
     }
 
-
     /**
-     * Determines whether or not the configured threshold has been exceeded for
-     * this output stream.
+     * Determines whether or not the configured threshold has been exceeded for this output stream.
      *
-     * @return {@code true} if the threshold has been reached;
-     *         {@code false} otherwise.
+     * @return {@code true} if the threshold has been reached; {@code false} otherwise.
      */
-    public boolean isThresholdExceeded()
-    {
+    public boolean isThresholdExceeded() {
         return written > threshold;
     }
 
-
     // ------------------------------------------------------ Protected methods
 
-
     /**
-     * Checks to see if writing the specified number of bytes would cause the
-     * configured threshold to be exceeded. If so, triggers an event to allow
-     * a concrete implementation to take action on this.
+     * Checks to see if writing the specified number of bytes would cause the configured threshold to be exceeded. If
+     * so, triggers an event to allow a concrete implementation to take action on this.
      *
-     * @param count The number of bytes about to be written to the underlying
-     *              output stream.
+     * @param count The number of bytes about to be written to the underlying output stream.
      *
      * @throws IOException if an error occurs.
      */
-    protected void checkThreshold(final int count) throws IOException
-    {
-        if (!thresholdExceeded && written + count > threshold)
-        {
+    protected void checkThreshold(final int count) throws IOException {
+        if (!thresholdExceeded && written + count > threshold) {
             thresholdExceeded = true;
             thresholdReached();
         }
     }
 
     /**
-     * Resets the byteCount to zero.  You can call this from
-     * {@link #thresholdReached()} if you want the event to be triggered again.
+     * Resets the byteCount to zero. You can call this from {@link #thresholdReached()} if you want the event to be
+     * triggered again.
      */
-    protected void resetByteCount()
-    {
+    protected void resetByteCount() {
         this.thresholdExceeded = false;
         this.written = 0;
     }
 
     /**
-     * Sets the byteCount to count.  Useful for re-opening an output stream
-     * that has previously been written to.
+     * Sets the byteCount to count. Useful for re-opening an output stream that has previously been written to.
      *
-     * @param count The number of bytes that have already been written to the
-     * output stream
+     * @param count The number of bytes that have already been written to the output stream
      *
      * @since 2.5
      */
@@ -246,13 +197,11 @@ public abstract class ThresholdingOutputStream
         this.written = count;
     }
 
-
     // ------------------------------------------------------- Abstract methods
 
-
     /**
-     * Returns the underlying output stream, to which the corresponding
-     * {@code OutputStream} methods in this class will ultimately delegate.
+     * Returns the underlying output stream, to which the corresponding {@code OutputStream} methods in this class will
+     * ultimately delegate.
      *
      * @return The underlying output stream.
      *
@@ -260,11 +209,9 @@ public abstract class ThresholdingOutputStream
      */
     protected abstract OutputStream getStream() throws IOException;
 
-
     /**
-     * Indicates that the configured threshold has been reached, and that a
-     * subclass should take whatever action necessary on this event. This may
-     * include changing the underlying output stream.
+     * Indicates that the configured threshold has been reached, and that a subclass should take whatever action
+     * necessary on this event. This may include changing the underlying output stream.
      *
      * @throws IOException if an error occurs.
      */