Ahh java, now seems so many different ways of doing the same thing....
Just importing a file, I also have standard utils.

The path is the tricky one now, without testing it.

value = FileUtils.readFileToString(new File(
                                        getProject().resolveFile(value)
                                                .getCanonicalPath()),
UTF_8);

Path thePath = FileSystems.getDefault().getPath(
                                        getProject().resolveFile(value)
                                        .getCanonicalPath());

value = new String(Files.readAllBytes(thePath),
                                        StandardCharsets.UTF_8);



On 26 January 2017 at 15:48, Claude Brisson <cla...@renegat.net> wrote:

> Oh, and Michael Osipov suggested a much easier way:
>
>     import java.nio.Files;
>     import java.nio.charset.StandardCharsets;
>     ....
>     String contents = new String(Files.readAllBytes(path),
> StandardCharsets.UTF_8);
>
>
>   Claude
>
> On 26/01/2017 15:42, Claude Brisson wrote:
>
>> Hi Greg.
>>
>> Just include the commons-io library [1], then do:
>>
>>     import org.apache.commons.io.FileUtils;
>>     ....
>>     String content = FiileUtils.readFileToString(new File(filename),
>> Charset.UTF_8);
>>
>> The charset parameter is optional but recommended. Adapt it to your
>> needs, of course.
>>
>> [1] https://mvnrepository.com/artifact/commons-io/commons-io/2.5
>>
>>
>>   Claude
>>
>> On 26/01/2017 14:52, Greg Huber wrote:
>>
>>> Hello,
>>>
>>> I use the taxen task, and now have a local copy as its no longer
>>> supported.
>>>
>>> What would be an equivalent to .fileContentsToString(..) as its now
>>> missing?
>>>
>>> org.apache.velocity.util.StringUtils
>>>
>>> value = StringUtils.fileContentsToString(
>>> getProject().resolveFile(value)
>>> .getCanonicalPath());
>>>
>>> Cheers Greg
>>>
>>>
>>>
>>> On 26 January 2017 at 03:39, Claude Brisson <cla...@renegat.net> wrote:
>>>
>>> A new test build of Velocity Engine 2.0 is available (RC6).
>>>>
>>>> No determination as to the quality ('alpha,' 'beta,' or 'GA') of
>>>> Velocity
>>>> Engine 2.0 has been made, and at this time it is simply a "test build".
>>>> We
>>>> welcome any comments you may have, and will take all feedback into
>>>> account
>>>> if a quality vote is called for this build.
>>>>
>>>> Release notes:
>>>>
>>>> * https://dist.apache.org/repos/dist/dev/velocity/velocity-eng
>>>> ine/2.0/release-notes.html
>>>>
>>>> Distribution:
>>>>
>>>>   * https://dist.apache.org/repos/dist/dev/velocity/velocity-eng
>>>> ine/2.0/
>>>>
>>>> Maven 2 staging repository:
>>>>
>>>>   * https://repository.apache.org/content/repositories/orgapache
>>>> velocity-1016/
>>>>
>>>> A vote regarding the quality of this test build will be initiated within
>>>> the next couple of days.
>>>>
>>>> Release Candidates changelog:
>>>>    RC1: initial candidate
>>>>    RC2: bugfixes
>>>>    RC3: review SLF4J Logger names (instead of a single logger named
>>>> "Velocity", have a hierarchy of loggers with a base of
>>>> 'org.apache.velocity')
>>>>    RC4: minor fixes
>>>>    RC5:
>>>>     * the default encoding is now UTF-8 (and not the platform default)
>>>>     * commons-collections is not any more a compilation dependency
>>>>     * commons-lang3 dependency is not any more shaded
>>>>     * the configuration API doesn't reference ExtProperties
>>>>     * the events API has been optimized and reviewed: all events do
>>>> receive
>>>> the current Context
>>>>     * there has been a few optimizations in ASTStringLiteral rendering
>>>> RC6: mostly code cleaning and build process optimization ; assembly
>>>> module
>>>> has been dropped
>>>>
>>>>
>>>> Regards,
>>>>
>>>>    Claude
>>>>
>>>>
>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: dev-h...@velocity.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
> For additional commands, e-mail: dev-h...@velocity.apache.org
>
>

Reply via email to