Non-static method wrappers for Files.readAllLines and Files.write
Find a file
dependabot-preview[bot] d40ae84ddd Bump assertj-core from 3.15.0 to 3.16.1
Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.15.0 to 3.16.1.
- [Release notes](https://github.com/joel-costigliola/assertj-core/releases)
- [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.15.0...assertj-core-3.16.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-09 17:26:53 +00:00
.github Initial Import 2020-03-29 10:46:14 +01:00
src Add missing javadoc tags 2020-03-29 11:20:16 +01:00
.gitignore Initial Import 2020-03-29 10:46:14 +01:00
pom.xml Bump assertj-core from 3.15.0 to 3.16.1 2020-05-09 17:26:53 +00:00
README.md Initial Import 2020-03-29 10:46:14 +01:00

File Reader/Writer

Sonatype Nexus (Release) Maven Central

Simple wrapper for the static methods Files.readAllLines and Files.write, bringing into simple classes that can be injected into code using Dependency Injection allowing them to be mocked during testing without touching the real filesystem.

Assumptions

  • All files will be read and written in ÙTF-8.
  • When reading a file lines breaks will be replaced by the newline character.
  • When writing a file it will be truncated first.

Usage

Jakarta EE

@Produces
FileReaderWriter fileReaderWriter() {
    return new FileReaderWriter();
}
@Produces
FileReader fileReader() {
    return new FileReaderWriter();
}
@Produces
FileWriter fileWriter() {
    return new FileReaderWriter();
}

Spring

@Bean
FileReaderWriter fileReaderWriter() {
    return new FileReaderWriter();
}
@Bean
FileReader fileReader() {
    return new FileReaderWriter();
}
@Bean
FileWriter fileWriter() {
    return new FileReaderWriter();
}