creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1549228 - /creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java
Date Sun, 08 Dec 2013 20:55:17 GMT
Author: rdonkin
Date: Sun Dec  8 20:55:17 2013
New Revision: 1549228

URL: http://svn.apache.org/r1549228
Log:
Format Code.

Modified:
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java?rev=1549228&r1=1549227&r2=1549228&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java
Sun Dec  8 20:55:17 2013
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat.header;
 
 import java.io.IOException;
@@ -23,37 +23,36 @@ import java.io.Reader;
 import java.nio.CharBuffer;
 
 class FilteringSequenceFactory {
-    
-    private static final int BUFFER_CAPACITY = 5000;
-    
-    private final CharBuffer buffer;
-    private final CharFilter filter;
-    
-    public FilteringSequenceFactory(final CharFilter filter) {
-        this(BUFFER_CAPACITY, filter);
-    }
-    
-    public FilteringSequenceFactory(final int capacity, final CharFilter filter) {
-        this.buffer = CharBuffer.allocate(capacity);
-        this.filter = filter;
-    }
-
-    public CharSequence filter(Reader reader) throws IOException {
-        buffer.clear();
-        boolean eof = false;
-        while(!eof) {
-            final int next = reader.read();
-            if (next == -1 || !buffer.hasRemaining()) {
-                eof = true;
-            } else {
-                final char character = (char) next;
-                if (!filter.isFilteredOut(character))
-                {
-                    buffer.put(character); 
-                }
-            }
-        }
-        buffer.limit(buffer.position()).rewind();
-        return buffer;
-    }
+
+	private static final int BUFFER_CAPACITY = 5000;
+
+	private final CharBuffer buffer;
+	private final CharFilter filter;
+
+	public FilteringSequenceFactory(final CharFilter filter) {
+		this(BUFFER_CAPACITY, filter);
+	}
+
+	public FilteringSequenceFactory(final int capacity, final CharFilter filter) {
+		this.buffer = CharBuffer.allocate(capacity);
+		this.filter = filter;
+	}
+
+	public CharSequence filter(Reader reader) throws IOException {
+		buffer.clear();
+		boolean eof = false;
+		while (!eof) {
+			final int next = reader.read();
+			if (next == -1 || !buffer.hasRemaining()) {
+				eof = true;
+			} else {
+				final char character = (char) next;
+				if (!filter.isFilteredOut(character)) {
+					buffer.put(character);
+				}
+			}
+		}
+		buffer.limit(buffer.position()).rewind();
+		return buffer;
+	}
 }



Mime
View raw message