[jira] Created: (IO-236) Add "Read" Methods With Size Limits to FileUtils

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (IO-236) Add "Read" Methods With Size Limits to FileUtils

JIRA jira@apache.org
Add "Read" Methods With Size Limits to FileUtils
------------------------------------------------

                 Key: IO-236
                 URL: https://issues.apache.org/jira/browse/IO-236
             Project: Commons IO
          Issue Type: Improvement
          Components: Utilities
    Affects Versions: 2.0
         Environment: 1.4+
            Reporter: Michael Wooten
            Priority: Minor
             Fix For: 2.0


I suggest adding versions of the utility methods for reading lines and Strings from a file that also accept a limit on the number of bytes or lines that should be read. I propose that the following methods be added:

String readFileToString(File file, long byteCountToRead)
String readFileToString(File file, String encoding, long byteCountToRead)
byte[] readFileToByteArray(File file, long byteCountToRead)
byte[] readFileToByteArray(File file, String encoding, long byteCountToRead)
List<String> readLines(File file, long lineCountToRead)
List<String> readLines(File file, String encoding, long lineCountToRead)

One of the drawbacks I have encountered to using the methods in the past is that I only needed to read a limited number of bytes or lines from a file and I had to read the entire file. This can be especially dangerous if run on a file that is quite large, and only a portion of the file is needed.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (IO-236) Add "Read" Methods With Size Limits to FileUtils

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/IO-236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated IO-236:
-------------------------------

    Fix Version/s: 2.x
                       (was: 2.0)

Needs a patch

> Add "Read" Methods With Size Limits to FileUtils
> ------------------------------------------------
>
>                 Key: IO-236
>                 URL: https://issues.apache.org/jira/browse/IO-236
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.0
>         Environment: 1.4+
>            Reporter: Michael Wooten
>            Priority: Minor
>             Fix For: 2.x
>
>   Original Estimate: 6h
>  Remaining Estimate: 6h
>
> I suggest adding versions of the utility methods for reading lines and Strings from a file that also accept a limit on the number of bytes or lines that should be read. I propose that the following methods be added:
> String readFileToString(File file, long byteCountToRead)
> String readFileToString(File file, String encoding, long byteCountToRead)
> byte[] readFileToByteArray(File file, long byteCountToRead)
> byte[] readFileToByteArray(File file, String encoding, long byteCountToRead)
> List<String> readLines(File file, long lineCountToRead)
> List<String> readLines(File file, String encoding, long lineCountToRead)
> One of the drawbacks I have encountered to using the methods in the past is that I only needed to read a limited number of bytes or lines from a file and I had to read the entire file. This can be especially dangerous if run on a file that is quite large, and only a portion of the file is needed.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.