You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/12/22 01:40:05 UTC

[GitHub] [commons-io] RobberPhex opened a new pull request #99: IO-458: add SequenceReader

RobberPhex opened a new pull request #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99
 
 
   <https://issues.apache.org/jira/browse/IO-458>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360715390
 
 

 ##########
 File path: src/main/java/org/apache/commons/io/input/SequenceReader.java
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+import static org.apache.commons.io.IOUtils.EOF;
+
+/**
+ * Provides the contents of multiple Readers in sequence.
+ *
+ * @since 2.7
+ */
+public class SequenceReader extends Reader {
+    private Reader[] fReaders;
+    private int fReadersOffset;
+
+    /**
+     * @param readers the readers from which to read
 
 Review comment:
   Incomplete Javadoc.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360715387
 
 

 ##########
 File path: src/main/java/org/apache/commons/io/input/SequenceReader.java
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+import static org.apache.commons.io.IOUtils.EOF;
+
+/**
+ * Provides the contents of multiple Readers in sequence.
+ *
+ * @since 2.7
+ */
+public class SequenceReader extends Reader {
+    private Reader[] fReaders;
+    private int fReadersOffset;
+
+    /**
+     * @param readers the readers from which to read
+     */
+    public SequenceReader(List<? extends Reader> readers) {
 
 Review comment:
   @RobberPhex 
   If you make the input a `Collection`, then you can take a `Set` as input.
   
   You should also consider using a List internally instead of an array. It might make the above simpler.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: Add a SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: Add a SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360904068
 
 

 ##########
 File path: src/test/java/org/apache/commons/io/input/SequenceReaderTest.java
 ##########
 @@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Test case for {@link SequenceReader}.
+ */
+public class SequenceReaderTest {
+    private static final char NONE = (new char[1])[0];
+
+    @Test
+    public void testClose() throws IOException {
+        final Reader reader = new CharSequenceReader("FooBar");
+        checkRead(reader, "Foo");
+        reader.close();
+        checkRead(reader, "Foo");
 
 Review comment:
   What does this test?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360715393
 
 

 ##########
 File path: src/main/java/org/apache/commons/io/input/SequenceReader.java
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+import static org.apache.commons.io.IOUtils.EOF;
+
+/**
+ * Provides the contents of multiple Readers in sequence.
+ *
+ * @since 2.7
+ */
+public class SequenceReader extends Reader {
+    private Reader[] fReaders;
+    private int fReadersOffset;
+
+    /**
+     * @param readers the readers from which to read
+     */
+    public SequenceReader(List<? extends Reader> readers) {
+        int size = readers.size();
+        fReaders = new Reader[size];
+        for (int i = 0; i < size; i++) {
+            fReaders[i] = readers.get(i);
+        }
+    }
+
+    /**
+     * @param readers the readers from which to read
 
 Review comment:
   Incomplete Javadoc.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360715447
 
 

 ##########
 File path: src/main/java/org/apache/commons/io/input/SequenceReader.java
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+import static org.apache.commons.io.IOUtils.EOF;
+
+/**
+ * Provides the contents of multiple Readers in sequence.
+ *
+ * @since 2.7
+ */
+public class SequenceReader extends Reader {
+    private Reader[] fReaders;
+    private int fReadersOffset;
 
 Review comment:
   No need for the "f" prefix which would means what? "field"?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] asfgit closed pull request #99: IO-458: Add a SequenceReader

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #99: IO-458: Add a SequenceReader
URL: https://github.com/apache/commons-io/pull/99
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: Add a SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: Add a SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360904095
 
 

 ##########
 File path: src/test/java/org/apache/commons/io/input/SequenceReaderTest.java
 ##########
 @@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Test case for {@link SequenceReader}.
+ */
+public class SequenceReaderTest {
+    private static final char NONE = (new char[1])[0];
+
+    @Test
+    public void testClose() throws IOException {
+        final Reader reader = new CharSequenceReader("FooBar");
+        checkRead(reader, "Foo");
+        reader.close();
+        checkRead(reader, "Foo");
+    }
+
+    @Test
+    public void testMarkSupported() throws Exception {
 
 Review comment:
   What does this test?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] garydgregory commented on a change in pull request #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#discussion_r360715512
 
 

 ##########
 File path: src/main/java/org/apache/commons/io/input/SequenceReader.java
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.io.input;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+import static org.apache.commons.io.IOUtils.EOF;
+
+/**
+ * Provides the contents of multiple Readers in sequence.
+ *
+ * @since 2.7
+ */
+public class SequenceReader extends Reader {
+    private Reader[] fReaders;
+    private int fReadersOffset;
+
+    /**
+     * @param readers the readers from which to read
+     */
+    public SequenceReader(List<? extends Reader> readers) {
+        int size = readers.size();
 
 Review comment:
   make `size` final.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] coveralls edited a comment on issue #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#issuecomment-568335522
 
 
   
   [![Coverage Status](https://coveralls.io/builds/27758196/badge)](https://coveralls.io/builds/27758196)
   
   Coverage decreased (-0.0001%) to 89.492% when pulling **27df07c4d9ae74d9dc459e9eeb1610653e555ded on RobberPhex:IO-458-SequenceReader** into **e46146c67026956d3f48d44be5c4df0fb78d5a42 on apache:master**.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [commons-io] coveralls commented on issue #99: IO-458: add SequenceReader

Posted by GitBox <gi...@apache.org>.
coveralls commented on issue #99: IO-458: add SequenceReader
URL: https://github.com/apache/commons-io/pull/99#issuecomment-568335522
 
 
   
   [![Coverage Status](https://coveralls.io/builds/27758040/badge)](https://coveralls.io/builds/27758040)
   
   Coverage increased (+0.02%) to 89.508% when pulling **de6b684aac7563b290b130864a002f101c89173c on RobberPhex:IO-458-SequenceReader** into **e46146c67026956d3f48d44be5c4df0fb78d5a42 on apache:master**.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services