You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2012/10/24 14:36:12 UTC

[jira] [Resolved] (IO-349) Add API with array offset and length argument to FileUtils.writeByteArrayToFile

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

Gary Gregory resolved IO-349.
-----------------------------

    Resolution: Fixed

It's simple unless the unit tests have subtle bugs ;)

commit -m "[IO-349] Add API with array offset and length argument to FileUtils.writeByteArrayToFile. Applied patch with changes: (1) Fixed bugs in unit tests (2) Added @since tags (3) Fixed formatting." C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/FileUtilsTestCase.java C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/FileUtils.java C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml C:/svn/org/apache/commons/trunks-proper/io/pom.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/io/pom.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/io/src/changes/changes.xml
    Sending        C:/svn/org/apache/commons/trunks-proper/io/src/main/java/org/apache/commons/io/FileUtils.java
    Sending        C:/svn/org/apache/commons/trunks-proper/io/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
    Transmitting file data ...
    Committed revision 1401648.
                
> Add API with array offset and length argument to FileUtils.writeByteArrayToFile
> -------------------------------------------------------------------------------
>
>                 Key: IO-349
>                 URL: https://issues.apache.org/jira/browse/IO-349
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.4
>            Reporter: David Bild
>              Labels: patch
>             Fix For: 2.5
>
>         Attachments: add_OffsetAndLengthArguments_To_FileUtils_writeByteArrayToFile.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The FileUtils.writeByteArrayToFile method does not allow a subset of an array to be written to a file.  Instead, the subset must be copied to a separate array, increasing the lines of code and (for all JVMs I know about) runtime.
> Sister methods that take an offset and length should be added, inline with the byte array-oriented methods in the Java standard library. 
> Attached is a patch that implements FileUtils.writeByteArrayToFile(File file, byte[] data, int offset, int length) and FileUtils.writeByteArrayToFile(File file, byte[] data, int offset, int length, boolean append) and associated testcases in FileUtilsTestCase.java.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira