You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/09/23 18:11:00 UTC

[jira] [Work logged] (IO-543) ReversedLinesFileReader with 'getFilePointer' and 'seek' API

     [ https://issues.apache.org/jira/browse/IO-543?focusedWorklogId=654656&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-654656 ]

ASF GitHub Bot logged work on IO-543:
-------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Sep/21 18:10
            Start Date: 23/Sep/21 18:10
    Worklog Time Spent: 10m 
      Work Description: garydgregory commented on a change in pull request #39:
URL: https://github.com/apache/commons-io/pull/39#discussion_r715037670



##########
File path: src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java
##########
@@ -134,17 +133,35 @@ public ReversedLinesFileReader(final File file, final int blockSize, final Chars
         // Open file
         randomAccessFile = new RandomAccessFile(file, "r");
         totalByteLength = randomAccessFile.length();
-        int lastBlockLength = (int) (totalByteLength % blockSize);
-        if (lastBlockLength > 0) {
-            totalBlockCount = totalByteLength / blockSize + 1;
+        seek (totalByteLength);
+
+    }
+    /**

Review comment:
       All new public and protected method should have complete Javadoc. Here the first sentence is missing as is the since tag.

##########
File path: src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java
##########
@@ -361,6 +383,13 @@ private int getNewLineMatchByteCount(final byte[] data, final int i) {
             }
             return 0;
         }
+
+        /**
+         * @return Returns the current offset in this file
+         */
+        public long getFilePointer(){

Review comment:
       Formatting is missing a space.




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

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 654656)
    Remaining Estimate: 0h
            Time Spent: 10m

> ReversedLinesFileReader with 'getFilePointer' and 'seek' API
> ------------------------------------------------------------
>
>                 Key: IO-543
>                 URL: https://issues.apache.org/jira/browse/IO-543
>             Project: Commons IO
>          Issue Type: Improvement
>    Affects Versions: 2.6
>            Reporter: Jean-Pierre Portier
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Adding API to get/set current file pointer position for org.apache.commons.io.input.ReversedLinesFileReader class:
> 	- long getFilePointer()
> 	- void seek(long pos)
> (they act like java.io.RandomAccessFile API class)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)