You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ol...@apache.org on 2014/10/28 00:48:50 UTC

svn commit: r1634744 - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/input/ test/java/org/apache/commons/io/input/

Author: olamy
Date: Mon Oct 27 23:48:50 2014
New Revision: 1634744

URL: http://svn.apache.org/r1634744
Log:
use spaces not tabs

Modified:
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BoundedReader.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BoundedReader.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BoundedReader.java?rev=1634744&r1=1634743&r2=1634744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BoundedReader.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/BoundedReader.java Mon Oct 27 23:48:50 2014
@@ -25,7 +25,7 @@ import java.io.Reader;
  * A reader that imposes a limit to the number of characters that can be read from
  * an underlying reader, returning eof when this limit is reached -regardless of state of
  * underlying reader.
- *
+ * <p/>
  * One use case is to avoid overrunning the readAheadLimit supplied to
  * java.io.Reader#mark(int), since reading too many characters removes the
  * ability to do a successful reset.
@@ -33,49 +33,53 @@ import java.io.Reader;
  * @since 2.5
  */
 public class BoundedReader
-    extends Reader {
+    extends Reader
+{
 
     private static final int INVALID = -1;
 
-	private final Reader target;
+    private final Reader target;
 
-	int charsRead = 0;
+    int charsRead = 0;
 
     int markedAt = INVALID;
 
-	int readAheadLimit; // Internally, this value will never exceed the allowed size
+    int readAheadLimit; // Internally, this value will never exceed the allowed size
 
     private final int maxCharsFromTargetReader;
 
     /**
      * Constructs a bounded reader
-     * @param target The target stream that will be used
+     *
+     * @param target                   The target stream that will be used
      * @param maxCharsFromTargetReader The maximum number of characters that can be read from target
      * @throws IOException if mark fails
      */
-	public BoundedReader( Reader target, int maxCharsFromTargetReader ) throws IOException {
-		this.target = target;
+    public BoundedReader( Reader target, int maxCharsFromTargetReader ) throws IOException {
+        this.target = target;
         this.maxCharsFromTargetReader = maxCharsFromTargetReader;
-	}
+    }
 
     /**
      * Closes the target
+     *
      * @throws IOException
      */
-	@Override
-	public void close() throws IOException {
-		target.close();
-	}
+    @Override
+    public void close() throws IOException {
+        target.close();
+    }
 
     /**
      * Resets the target to the latest mark, @see java.io.Reader#reset()
+     *
      * @throws IOException
      */
-	@Override
-	public void reset() throws IOException {
-		charsRead = markedAt;
-		target.reset();
-	}
+    @Override
+    public void reset() throws IOException {
+        charsRead = markedAt;
+        target.reset();
+    }
 
     /**
      * marks the target stream, @see java.io.Reader#mark(int).
@@ -87,50 +91,54 @@ public class BoundedReader
      *                       past maxCharsFromTargetReader, even if this value is
      *                       greater.
      */
-	@Override
-	public void mark(int readAheadLimit) throws IOException {
-		this.readAheadLimit = readAheadLimit -charsRead;
+    @Override
+    public void mark( int readAheadLimit ) throws IOException {
+        this.readAheadLimit = readAheadLimit - charsRead;
 
         markedAt = charsRead;
 
-		target.mark(readAheadLimit);
-	}
+        target.mark( readAheadLimit );
+    }
 
     /**
      * Reads a single character, @see java.io.Reader#read()
+     *
      * @return -1 on eof or the character read
      * @throws IOException If an I/O error occurs
      */
-	@Override
-	public int read() throws IOException {
+    @Override
+    public int read() throws IOException {
 
-		if ( charsRead >= maxCharsFromTargetReader) {
-			return -1;
-		}
-
-        if ( markedAt >= 0 && (charsRead  -markedAt) >= readAheadLimit) {
-			return -1;
-		}
-		charsRead++;
-		return target.read();
-	}
+        if ( charsRead >= maxCharsFromTargetReader ) {
+            return -1;
+        }
+
+        if ( markedAt >= 0 && ( charsRead - markedAt ) >= readAheadLimit ) {
+            return -1;
+        }
+        charsRead++;
+        return target.read();
+    }
 
     /**
      * Reads into an array, @see java.io.Reader#read(char[], int, int)
+     *
      * @param cbuf The buffer to fill
-     * @param off The offset
-     * @param len The number of chars to read
+     * @param off  The offset
+     * @param len  The number of chars to read
      * @return the number of chars read
      * @throws IOException
      */
-	@Override
-	public int read(char[] cbuf, int off, int len) throws IOException {
-		int c;
-		for (int i = 0; i < len; i++){
-			c = read();
-			if (c == -1) return i;
-			cbuf[off + i] = (char) c;
-		}
-		return len;
-	}
+    @Override
+    public int read( char[] cbuf, int off, int len ) throws IOException {
+        int c;
+        for ( int i = 0; i < len; i++ ) {
+            c = read();
+            if ( c == -1 ) {
+                return i;
+            }
+            cbuf[off + i] = (char) c;
+        }
+        return len;
+    }
 }

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java?rev=1634744&r1=1634743&r2=1634744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/UnixLineEndingInputStream.java Mon Oct 27 23:48:50 2014
@@ -24,87 +24,87 @@ import java.io.InputStream;
 
 /**
  * A filtering input stream that ensures the content will have unix-style line endings, LF.
+ *
  * @since 2.5
  */
-public class UnixLineEndingInputStream
-		extends InputStream {
+public class UnixLineEndingInputStream extends InputStream {
 
-	private boolean slashNSeen = false;
+    private boolean slashNSeen = false;
 
-	private boolean eofSeen = false;
+    private boolean eofSeen = false;
 
-	private final InputStream target;
+    private final InputStream target;
 
-	private final boolean ensureLineFeedAtEndOfFile;
-
-	/**
-	 * Create an input stream that filters another stream
-	 *
-	 * @param in                        The input stream to wrap
-	 * @param ensureLineFeedAtEndOfFile true to ensure that the file ends with LF
-	 */
-	public UnixLineEndingInputStream(InputStream in, boolean ensureLineFeedAtEndOfFile) {
-		this.target = in;
-		this.ensureLineFeedAtEndOfFile = ensureLineFeedAtEndOfFile;
-	}
-
-	private int readWithUpdate() throws IOException {
-		final int target = this.target.read();
-		eofSeen = target == -1;
-		if (eofSeen) {
-			return target;
-		}
-		slashNSeen = target == '\n';
-		return target;
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-
-	@Override public int read()
-			throws IOException {
-		if (eofSeen) {
-			return eofGame();
-		} else {
-			int target = readWithUpdate();
-			if (eofSeen) {
-				return eofGame();
-			}
-			if (target == '\r') {
-				target = readWithUpdate();
-			}
-			return target;
-		}
-	}
-
-	private int eofGame() {
-		if (!ensureLineFeedAtEndOfFile) {
-			return -1;
-		}
-		if (!slashNSeen) {
-			slashNSeen = true;
-			return '\n';
-		} else {
-			return -1;
-		}
-	}
-
-	/**
-	 * Closes the stream. Also closes the underlying stream.
-	 */
-	@Override
-	public void close()
-			throws IOException {
-		super.close();
-		target.close();
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	@Override
-	public synchronized void mark(int readlimit) {
-		throw new UnsupportedOperationException("Mark notsupported");
-	}
+    private final boolean ensureLineFeedAtEndOfFile;
+
+    /**
+     * Create an input stream that filters another stream
+     *
+     * @param in                        The input stream to wrap
+     * @param ensureLineFeedAtEndOfFile true to ensure that the file ends with LF
+     */
+    public UnixLineEndingInputStream( InputStream in, boolean ensureLineFeedAtEndOfFile ) {
+        this.target = in;
+        this.ensureLineFeedAtEndOfFile = ensureLineFeedAtEndOfFile;
+    }
+
+    private int readWithUpdate() throws IOException {
+        final int target = this.target.read();
+        eofSeen = target == -1;
+        if ( eofSeen ) {
+            return target;
+        }
+        slashNSeen = target == '\n';
+        return target;
+    }
+
+    /**
+     * @inheritDoc
+     */
+
+    @Override
+    public int read() throws IOException {
+        if ( eofSeen ) {
+            return eofGame();
+        }
+        else {
+            int target = readWithUpdate();
+            if ( eofSeen ) {
+                return eofGame();
+            }
+            if ( target == '\r' ) {
+                target = readWithUpdate();
+            }
+            return target;
+        }
+    }
+
+    private int eofGame() {
+        if ( !ensureLineFeedAtEndOfFile ) {
+            return -1;
+        }
+        if ( !slashNSeen ) {
+            slashNSeen = true;
+            return '\n';
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     * Closes the stream. Also closes the underlying stream.
+     */
+    @Override
+    public void close() throws IOException {
+        super.close();
+        target.close();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public synchronized void mark( int readlimit ) {
+        throw new UnsupportedOperationException( "Mark notsupported" );
+    }
 }

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java?rev=1634744&r1=1634743&r2=1634744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java Mon Oct 27 23:48:50 2014
@@ -25,99 +25,100 @@ import java.io.InputStream;
 /**
  * A filtering input stream that ensures the content will have windows line endings, CRLF.
  */
-public class WindowsLineEndingInputStream
-		extends InputStream {
+public class WindowsLineEndingInputStream  extends InputStream {
 
-	private boolean slashRSeen = false;
+    private boolean slashRSeen = false;
 
-	private boolean slashNSeen = false;
+    private boolean slashNSeen = false;
 
-	private boolean injectSlashN = false;
+    private boolean injectSlashN = false;
 
-	private boolean eofSeen = false;
-
-	private final InputStream target;
-
-	private final boolean ensureLineFeedAtEndOfFile;
-
-	/**
-	 * Create an input stream that filters another stream
-	 *
-	 * @param in                        The input stream to wrap
-	 * @param ensureLineFeedAtEndOfFile true to ensure that the file ends with CRLF
-	 */
-	public WindowsLineEndingInputStream(InputStream in, boolean ensureLineFeedAtEndOfFile) {
-		this.target = in;
-		this.ensureLineFeedAtEndOfFile = ensureLineFeedAtEndOfFile;
-	}
-
-	private int readWithUpdate() throws IOException {
-		final int target = this.target.read();
-		eofSeen = target == -1;
-		if (eofSeen) {
-			return target;
-		}
-		slashRSeen = target == '\r';
-		slashNSeen = target == '\n';
-		return target;
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	@Override
-	public int read() throws IOException {
-		if (eofSeen) {
-			return eofGame();
-		} else if (injectSlashN) {
-			injectSlashN = false;
-			return '\n';
-		} else {
-			boolean prevWasSlashR = slashRSeen;
-			int target = readWithUpdate();
-			if (eofSeen) {
-				return eofGame();
-			}
-			if (target == '\n') {
-				if (!prevWasSlashR) {
-					injectSlashN = true;
-					return '\r';
-				}
-			}
-			return target;
-		}
-	}
-
-	private int eofGame() {
-		if (!ensureLineFeedAtEndOfFile) {
-			return -1;
-		}
-		if (!slashNSeen && !slashRSeen) {
-			slashRSeen = true;
-			return '\r';
-		}
-		if (!slashNSeen) {
-			slashRSeen = false;
-			slashNSeen = true;
-			return '\n';
-		} else {
-			return -1;
-		}
-	}
-
-	/**
-	 * Closes the stream. Also closes the underlying stream.
-	 */
-	@Override
-	public void close() throws IOException {
-		super.close();
-		target.close();
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	@Override public synchronized void mark(int readlimit) {
-		throw new UnsupportedOperationException("Mark not supported");
-	}
+    private boolean eofSeen = false;
+
+    private final InputStream target;
+
+    private final boolean ensureLineFeedAtEndOfFile;
+
+    /**
+     * Create an input stream that filters another stream
+     *
+     * @param in                        The input stream to wrap
+     * @param ensureLineFeedAtEndOfFile true to ensure that the file ends with CRLF
+     */
+    public WindowsLineEndingInputStream( InputStream in, boolean ensureLineFeedAtEndOfFile ) {
+        this.target = in;
+        this.ensureLineFeedAtEndOfFile = ensureLineFeedAtEndOfFile;
+    }
+
+    private int readWithUpdate() throws IOException {
+        final int target = this.target.read();
+        eofSeen = target == -1;
+        if ( eofSeen ) {
+            return target;
+        }
+        slashRSeen = target == '\r';
+        slashNSeen = target == '\n';
+        return target;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int read() throws IOException {
+        if ( eofSeen ) {
+            return eofGame();
+        } else if ( injectSlashN ) {
+            injectSlashN = false;
+            return '\n';
+        } else {
+            boolean prevWasSlashR = slashRSeen;
+            int target = readWithUpdate();
+            if ( eofSeen ) {
+                return eofGame();
+            }
+            if ( target == '\n' ) {
+                if ( !prevWasSlashR )
+                {
+                    injectSlashN = true;
+                    return '\r';
+                }
+            }
+            return target;
+        }
+    }
+
+    private int eofGame() {
+        if ( !ensureLineFeedAtEndOfFile ) {
+            return -1;
+        }
+        if ( !slashNSeen && !slashRSeen ) {
+            slashRSeen = true;
+            return '\r';
+        }
+        if ( !slashNSeen ) {
+            slashRSeen = false;
+            slashNSeen = true;
+            return '\n';
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     * Closes the stream. Also closes the underlying stream.
+     */
+    @Override
+    public void close() throws IOException {
+        super.close();
+        target.close();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public synchronized void mark( int readlimit ) {
+        throw new UnsupportedOperationException( "Mark not supported" );
+    }
 }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java?rev=1634744&r1=1634743&r2=1634744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BoundedReaderTest.java Mon Oct 27 23:48:50 2014
@@ -31,105 +31,111 @@ import static org.junit.Assert.assertTru
 
 public class BoundedReaderTest
 {
-	private final Reader sr = new BufferedReader(new StringReader("01234567890"));
-    private final Reader shortReader = new BufferedReader(new StringReader("01"));
+    private final Reader sr = new BufferedReader( new StringReader( "01234567890" ) );
 
-	@Test
-	public void readTillEnd() throws IOException {
-		BoundedReader mr = new BoundedReader(sr, 3);
-		mr.read();
-		mr.read();
-		mr.read();
-		assertEquals(-1, mr.read());
-	}
+    private final Reader shortReader = new BufferedReader( new StringReader( "01" ) );
+
+    @Test
+    public void readTillEnd() throws IOException {
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        mr.read();
+        mr.read();
+        mr.read();
+        assertEquals( -1, mr.read() );
+    }
 
     @Test
     public void shortReader() throws IOException {
-        BoundedReader mr = new BoundedReader(shortReader, 3);
+        BoundedReader mr = new BoundedReader( shortReader, 3 );
         mr.read();
         mr.read();
-        assertEquals(-1, mr.read());
+        assertEquals( -1, mr.read() );
     }
 
-	@Test
-	public void readMulti() throws IOException {
-		BoundedReader mr = new BoundedReader(sr, 3);
-		char[] cbuf = new char[4];
-		for (int i= 0; i < cbuf.length; i++) cbuf[i] = 'X';
-		final int read = mr.read(cbuf, 0, 4);
-		assertEquals( 3, read);
-		assertEquals('0', cbuf[0]);
-		assertEquals('1', cbuf[1]);
-		assertEquals('2', cbuf[2]);
-		assertEquals('X', cbuf[3]);
-	}
-
-	@Test
-	public void readMultiWithOffset() throws IOException {
-		BoundedReader mr = new BoundedReader(sr, 3);
-		char[] cbuf = new char[4];
-		for (int i= 0; i < cbuf.length; i++) cbuf[i] = 'X';
-		final int read = mr.read(cbuf, 1, 2);
-		assertEquals( 2, read);
-		assertEquals('X', cbuf[0]);
-		assertEquals('0', cbuf[1]);
-		assertEquals('1', cbuf[2]);
-		assertEquals('X', cbuf[3]);
-	}
-
-	@Test
-	public void markReset() throws IOException {
-		BoundedReader mr = new BoundedReader(sr,3 );
-        mr.mark(3);
-		mr.read();
-		mr.read();
-		mr.read();
-		mr.reset();
-		mr.read();
-		mr.read();
-		mr.read();
-		assertEquals(-1, mr.read());
-	}
+    @Test
+    public void readMulti() throws IOException {
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        char[] cbuf = new char[4];
+        for ( int i = 0; i < cbuf.length; i++ )
+        {
+            cbuf[i] = 'X';
+        }
+        final int read = mr.read( cbuf, 0, 4 );
+        assertEquals( 3, read );
+        assertEquals( '0', cbuf[0] );
+        assertEquals( '1', cbuf[1] );
+        assertEquals( '2', cbuf[2] );
+        assertEquals( 'X', cbuf[3] );
+    }
+
+    @Test
+    public void readMultiWithOffset() throws IOException {
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        char[] cbuf = new char[4];
+        for ( int i = 0; i < cbuf.length; i++ ) {
+            cbuf[i] = 'X';
+        }
+        final int read = mr.read( cbuf, 1, 2 );
+        assertEquals( 2, read );
+        assertEquals( 'X', cbuf[0] );
+        assertEquals( '0', cbuf[1] );
+        assertEquals( '1', cbuf[2] );
+        assertEquals( 'X', cbuf[3] );
+    }
+
+    @Test
+    public void markReset() throws IOException {
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        mr.mark( 3 );
+        mr.read();
+        mr.read();
+        mr.read();
+        mr.reset();
+        mr.read();
+        mr.read();
+        mr.read();
+        assertEquals( -1, mr.read() );
+    }
 
 
     @Test
     public void markResetWithMarkOutsideBoundedReaderMax() throws IOException {
-        BoundedReader mr = new BoundedReader(sr,3 );
-        mr.mark(4);
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        mr.mark( 4 );
         mr.read();
         mr.read();
         mr.read();
-        assertEquals(-1, mr.read());
+        assertEquals( -1, mr.read() );
     }
 
     @Test
     public void markResetWithMarkOutsideBoundedReaderMaxAndInitialOffset() throws IOException {
-        BoundedReader mr = new BoundedReader(sr,3 );
+        BoundedReader mr = new BoundedReader( sr, 3 );
         mr.read();
-        mr.mark(3);
+        mr.mark( 3 );
         mr.read();
         mr.read();
-        assertEquals(-1, mr.read());
+        assertEquals( -1, mr.read() );
     }
 
     @Test
     public void markResetFromOffset1() throws IOException {
-        BoundedReader mr = new BoundedReader(sr,3 );
+        BoundedReader mr = new BoundedReader( sr, 3 );
         mr.mark( 3 );
         mr.read();
         mr.read();
         mr.read();
-        assertEquals(-1, mr.read());
+        assertEquals( -1, mr.read() );
         mr.reset();
         mr.mark( 1 );
         mr.read();
-        assertEquals(-1, mr.read());
+        assertEquals( -1, mr.read() );
     }
 
     @Test
     public void markResetMarkMore() throws IOException {
-        BoundedReader mr = new BoundedReader(sr,3 );
-        mr.mark(4);
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        mr.mark( 4 );
         mr.read();
         mr.read();
         mr.read();
@@ -137,33 +143,32 @@ public class BoundedReaderTest
         mr.read();
         mr.read();
         mr.read();
-        assertEquals(-1, mr.read());
+        assertEquals( -1, mr.read() );
     }
 
-	@Test
-	public void skipTest() throws IOException {
-		BoundedReader mr = new BoundedReader(sr, 3);
-		mr.skip(2);
-		mr.read();
-		assertEquals(-1, mr.read());
-	}
+    @Test
+    public void skipTest() throws IOException {
+        BoundedReader mr = new BoundedReader( sr, 3 );
+        mr.skip( 2 );
+        mr.read();
+        assertEquals( -1, mr.read() );
+    }
 
     @Test
-    public void closeTest()
-        throws IOException
-    {
+    public void closeTest() throws IOException {
         final AtomicBoolean closed = new AtomicBoolean( false );
-        final Reader sr = new BufferedReader(new StringReader("01234567890")){
+        final Reader sr = new BufferedReader( new StringReader( "01234567890" ) ) {
             @Override
             public void close()
-                throws IOException {
+                throws IOException
+            {
                 closed.set( true );
                 super.close();
             }
         };
 
-        BoundedReader mr = new BoundedReader( sr,3 );
+        BoundedReader mr = new BoundedReader( sr, 3 );
         mr.close();
-        assertTrue( closed.get());
+        assertTrue( closed.get() );
     }
 }
\ No newline at end of file

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java?rev=1634744&r1=1634743&r2=1634744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/UnixLineEndingInputStreamTest.java Mon Oct 27 23:48:50 2014
@@ -1,55 +1,56 @@
 package org.apache.commons.io.input;
 
-import static org.junit.Assert.*;
+import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
-public class UnixLineEndingInputStreamTest {
+public class UnixLineEndingInputStreamTest
+{
 
-	@Test
-	public void simpleString() throws Exception {
-		assertEquals("abc\n", roundtrip("abc"));
-	}
-
-	@Test
-	public void inTheMiddleOfTheLine() throws Exception {
-		assertEquals("a\nbc\n", roundtrip("a\r\nbc"));
-	}
-
-	@Test
-	public void multipleBlankLines() throws Exception {
-		assertEquals("a\n\nbc\n", roundtrip("a\r\n\r\nbc"));
-	}
-
-	@Test
-	public void twoLinesAtEnd() throws Exception {
-		assertEquals("a\n\n", roundtrip("a\r\n\r\n"));
-	}
-
-	@Test
-	public void malformed() throws Exception {
-		assertEquals("abc", roundtrip("a\rbc", false));
-	}
-
-	@Test
-	public void retainLineFeed() throws Exception {
-		assertEquals("a\n\n", roundtrip("a\r\n\r\n", false));
-		assertEquals("a", roundtrip("a", false));
-	}
-
-	private String roundtrip(String msg) throws IOException {
-		return roundtrip(msg, true);
-	}
-
-	private String roundtrip(String msg, boolean ensure) throws IOException {
-		ByteArrayInputStream baos = new ByteArrayInputStream(msg.getBytes("UTF-8"));
-		UnixLineEndingInputStream lf = new UnixLineEndingInputStream(baos, ensure);
-		byte[] buf = new byte[100];
-		final int read = lf.read(buf);
-		return new String(buf, 0, read, "UTF-8");
-	}
+    @Test
+    public void simpleString() throws Exception {
+        assertEquals( "abc\n", roundtrip( "abc" ) );
+    }
+
+    @Test
+    public void inTheMiddleOfTheLine() throws Exception {
+        assertEquals( "a\nbc\n", roundtrip( "a\r\nbc" ) );
+    }
+
+    @Test
+    public void multipleBlankLines() throws Exception {
+        assertEquals( "a\n\nbc\n", roundtrip( "a\r\n\r\nbc" ) );
+    }
+
+    @Test
+    public void twoLinesAtEnd() throws Exception {
+        assertEquals( "a\n\n", roundtrip( "a\r\n\r\n" ) );
+    }
+
+    @Test
+    public void malformed() throws Exception {
+        assertEquals( "abc", roundtrip( "a\rbc", false ) );
+    }
+
+    @Test
+    public void retainLineFeed() throws Exception {
+        assertEquals( "a\n\n", roundtrip( "a\r\n\r\n", false ) );
+        assertEquals( "a", roundtrip( "a", false ) );
+    }
+
+    private String roundtrip( String msg ) throws IOException {
+        return roundtrip( msg, true );
+    }
+
+    private String roundtrip( String msg, boolean ensure ) throws IOException {
+        ByteArrayInputStream baos = new ByteArrayInputStream( msg.getBytes( "UTF-8" ) );
+        UnixLineEndingInputStream lf = new UnixLineEndingInputStream( baos, ensure );
+        byte[] buf = new byte[100];
+        final int read = lf.read( buf );
+        return new String( buf, 0, read, "UTF-8" );
+    }
 
 }
\ No newline at end of file

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java?rev=1634744&r1=1634743&r2=1634744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/WindowsLineEndingInputStreamTest.java Mon Oct 27 23:48:50 2014
@@ -18,61 +18,61 @@ package org.apache.commons.io.input;
  * under the License.
  */
 
-import static org.junit.Assert.assertEquals;
+import org.junit.Test;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 public class WindowsLineEndingInputStreamTest {
-	@Test
-	public void simpleString() throws Exception {
-		assertEquals("abc\r\n", roundtrip("abc"));
-	}
-
-	@Test
-	public void inTheMiddleOfTheLine() throws Exception {
-		assertEquals("a\r\nbc\r\n", roundtrip("a\r\nbc"));
-	}
-
-	@Test
-	public void multipleBlankLines() throws Exception {
-		assertEquals("a\r\n\r\nbc\r\n", roundtrip("a\r\n\r\nbc"));
-	}
-
-	@Test
-	public void twoLinesAtEnd() throws Exception {
-		assertEquals("a\r\n\r\n", roundtrip("a\r\n\r\n"));
-	}
-
-	@Test
-	public void linuxLinefeeds() throws Exception {
-		final String roundtrip = roundtrip("ab\nc", false);
-		assertEquals("ab\r\nc", roundtrip);
-	}
-
-
-	@Test
-	public void malformed() throws Exception {
-		assertEquals("a\rbc", roundtrip("a\rbc", false));
-	}
-
-	@Test
-	public void retainLineFeed() throws Exception {
-		assertEquals("a\r\n\r\n", roundtrip("a\r\n\r\n", false));
-		assertEquals("a", roundtrip("a", false));
-	}
-
-	private String roundtrip(String msg) throws IOException {
-		return roundtrip(msg, true);
-	}
-
-	private String roundtrip(String msg, boolean ensure) throws IOException {
-		ByteArrayInputStream baos = new ByteArrayInputStream(msg.getBytes("UTF-8"));
-		WindowsLineEndingInputStream lf = new WindowsLineEndingInputStream(baos, ensure);
-		byte[] buf = new byte[100];
-		final int read = lf.read(buf);
-		return new String(buf, 0, read, "UTF-8");
-	}
+    @Test
+    public void simpleString() throws Exception {
+        assertEquals( "abc\r\n", roundtrip( "abc" ) );
+    }
+
+    @Test
+    public void inTheMiddleOfTheLine() throws Exception {
+        assertEquals( "a\r\nbc\r\n", roundtrip( "a\r\nbc" ) );
+    }
+
+    @Test
+    public void multipleBlankLines() throws Exception {
+        assertEquals( "a\r\n\r\nbc\r\n", roundtrip( "a\r\n\r\nbc" ) );
+    }
+
+    @Test
+    public void twoLinesAtEnd() throws Exception {
+        assertEquals( "a\r\n\r\n", roundtrip( "a\r\n\r\n" ) );
+    }
+
+    @Test
+    public void linuxLinefeeds() throws Exception {
+        final String roundtrip = roundtrip( "ab\nc", false );
+        assertEquals( "ab\r\nc", roundtrip );
+    }
+
+
+    @Test
+    public void malformed() throws Exception {
+        assertEquals( "a\rbc", roundtrip( "a\rbc", false ) );
+    }
+
+    @Test
+    public void retainLineFeed() throws Exception {
+        assertEquals( "a\r\n\r\n", roundtrip( "a\r\n\r\n", false ) );
+        assertEquals( "a", roundtrip( "a", false ) );
+    }
+
+    private String roundtrip( String msg ) throws IOException {
+        return roundtrip( msg, true );
+    }
+
+    private String roundtrip( String msg, boolean ensure ) throws IOException {
+        ByteArrayInputStream baos = new ByteArrayInputStream( msg.getBytes( "UTF-8" ) );
+        WindowsLineEndingInputStream lf = new WindowsLineEndingInputStream( baos, ensure );
+        byte[] buf = new byte[100];
+        final int read = lf.read( buf );
+        return new String( buf, 0, read, "UTF-8" );
+    }
 }
\ No newline at end of file